Bug #89620
closedCreating MM relations in a group field with a translatable table causes translated records to show up twice
100%
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.
Updated by Johannes Schlier about 5 years ago
- Subject changed from Creating MM relations in a group field with a translatable table causes each record to show up twice to Creating MM relations in a group field with a translatable table causes translated records to show up twice
Updated by Oliver Bartsch about 5 years ago
- Related to Bug #89659: Translating a record creates superfluous wrong mm relations added
Updated by Christian Kuhn about 3 years ago
- Related to Bug #91842: Entries in sys_category_record_mm are created also for translated categories added
Updated by Christian Kuhn about 3 years ago
- Related to Bug #77902: Translating category causes creation of non-necessary relations added
Updated by Gerrit Code Review about 3 years ago
- Status changed from New to Under Review
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/71094
Updated by Christian Kuhn about 3 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset e5dbc1e775667ffcd4f8b46ab4cae2c535d2fcd7.