Issue Bug New Orphaned

#107078Bidirectional editing of records with multiple languages sets wrong uids in mm-table

Philipp Schlosser 07/11/25, 12:31 updated 07/11/25, 13:51

Description

Im trying to have a bidirectional link across two models. One Product can contain multiple productgroups and one productgroup can contain multiple products. Best case is to edit records on both sides in backend. So I configured the TCA like this:

// TCA of tx_sitepackage_domain_model_product.php

'groups' => [
    'label' => 'Groups',
    'l10n_mode' => 'exclude',
    'config' => [
        'type' => 'group',
        'foreign_table' => 'tx_sitepackage_domain_model_group',
        'allowed' => 'tx_sitepackage_domain_model_group',
        'MM' => 'tx_sitepackage_domain_model_product_group_mm',
    ]
],

// TCA of tx_sitepackage_domain_model_group.php

'products' => [
    'label' => 'Products',
    'l10n_mode' => 'exclude',
    'config' => [
        'type' => 'group',
        'foreign_table' => 'tx_sitepackage_domain_model_product',
        'allowed' => 'tx_sitepackage_domain_model_product',
        'MM_opposite_field' => 'groups',
        'MM' => 'tx_sitepackage_domain_model_product_group_mm',
    ]
],

Works nice as long there is only one language available in the system. I can edit both ways and my models contain all related models.
As soon as I add another language and start translating my records, the behaviour gets strange.

let’s create „Group 1“ and „Product 1“ and translate it („Group 1 EN“ / „Product 1 EN“). Let’s edit Group 1 and add Product 1 to it. So far it seems to be fine. But if edit Product 1 we see in our groups field both „Group 1“ and „Group 1 EN“. Also in our product model in frontend, in default language there are both groups and in translated model is no group.

MM table looks like this:

_.uid_local (product) _.uid_foreign (group)
1 5
1 6

UIDs of records:
Product 1: 1
Product 1 EN: 2
Group 1: 5
Group 1 EN: 6

In my opinion uid local in second row should be the translated uid (2) instead of defaultlanguage uid (1). If I change it in DB from 1 to 2, it seems to work as indented.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

Commit message
[BUGFIX] Bidirectional editing of records with multiple languages sets wrong uids in mm-table Resolves: #107078 Releases: main