Project

General

Profile

Actions

Bug #89620

closed

Creating MM relations in a group field with a translatable table causes translated records to show up twice

Added by Johannes Schlier about 5 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Start date:
2019-11-08
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I have the following problem:

I have two tables, for example project and person.
These two are connected using the TYPO3 'MM' relation type.

The person table has the following TCA definition:

'projects_lead' => [
  'l10n_mode' => 'exclude',
  'config' => [
    'type' => 'select',
    'renderType' => 'selectMultipleSideBySide',
    'foreign_table' => 'tx_example_domain_model_project',
    'foreign_table_where' => 'tx_example_domain_model_project.sys_language_uid=0',
    'MM' => 'tx_example_mm_person_project',
    'MM_match_fields' => [
      'type' => 1
    ]
  ]
]

This all works as expected.

The definition for the projects is the following:

'lead' => [
  'l10n_mode' => 'exclude',
  'config' => [
    'type' => 'group',
    'internal_type' => 'db',
    'allowed' => 'tx_example_domain_model_person',
    'MM' => 'tx_example_mm_person_project',
    'MM_opposite_field' => 'projects_lead',
    'MM_match_fields' => [
      'type' => 1
    ],
    'suggestOptions' => [
      'tx_example_domain_model_person' => [
        'searchCondition' => 'sys_language_uid=0'
      ],
    ]
  ]
]

For this side I use the group type so TYPO3 does not load all available people into the select (if there's a lot of them this is not really desired) and to use the nice search as you type box.
In my case, there is also a type match to allow people to be connected with different positions (as lead for example), but this shouldn't have any effect on the behaviour.

From the person side of the relation everything works as expected but from the project side I now face the following problem:

When searching for a person using the suggest wizard everything works fine, I only get the default language version of people.

When adding a person that has a translation, TYPO3 creates duplicated relations within the mm table for the translation.
This is fine, but upon opening the record TYPO3 now sees two relations, one to the default language person and one to the translated person.

In my opinion and case, the translation should not show up as it only confuses editors. Seeing the same name twice makes you think there are duplicates when, in this case, there actually aren't.

Of course this is a bit more complex if the relations fields can differ for translations.

Maybe we could check both sides for their 'l10n_mode' setting. If a translation of a person can have different relations, it would be correct to show both versions of the person.
Since both sides are set to 'l10n_mode' => 'exclude', this behaviour is not quite as expected and wanted.

The select element does handle this correctly - maybe through the 'foreign_table_where'.
The group element unfortunately does not offer a similar functionality, but this should be considered as a use case to catch.


Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Bug #89659: Translating a record creates superfluous wrong mm relationsClosed2019-11-13

Actions
Related to TYPO3 Core - Bug #91842: Entries in sys_category_record_mm are created also for translated categoriesClosed2020-07-22

Actions
Related to TYPO3 Core - Bug #77902: Translating category causes creation of non-necessary relationsClosed2016-09-09

Actions
Actions

Also available in: Atom PDF