#92777TCA l10n_mode exclude (as well as allow language syncronisation bahviour) and bidirectional MM relations cause Extbase to use uidLocalized instead of UID from foreign side
Description
in TYPO3 v10.4.9 when I use the following tx_csdummy_domain_model_product.php TCA
'items' => [
'l10n_mode' => 'exclude',
'config' => [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'foreign_table' => 'tx_csdummy_domain_model_item',
'foreign_table_where' => ' AND (tx_csdummy_domain_model_item.sys_language_uid IN (0,-1)) ORDER BY title ASC',
'MM' => 'tx_csdummy_product_item_mm',
]
],
],
and in the tx_csdummy_domain_model_item.php TCA
'products' => [
'l10n_mode' => 'exclude',
'config' => [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'foreign_table' => 'tx_csdummy_domain_model_product',
'foreign_table_where' => ' AND (tx_csdummy_domain_model_product.sys_language_uid IN (0,-1)) ORDER BY title ASC',
'MM' => 'tx_csdummy_product_item_mm',
'MM_opposite_field' => 'items',
]
],
],
it works in the default language as it should. But when I have both sites translated, something goes wrong.
For example I have porduct default (uid=1), product translated (uid=2), item default (uid=5) and item translated (uid=6).
A) If I save the product, then the uid of the translated product points to the default language uid of the item.
tx_csdummy_product_item_mm uid_local uid_foreign 1 5 2 5
B) If I save the item, then the uid of the translated item points to the default language uid of the product.
tx_csdummy_product_item_mm uid_local uid_foreign 1 5 1 6
With A I can’t see the related product in the english version of the item in frontend. With B I can’t see the related item in the english version of the product.
https://stackoverflow.com/questions/64678793/typo3-tca-l10n-mode-exclude-and-mm-relations
Reviews 1
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:". The changes above were merged or abandoned: read them before you start. How to create a patch
- Commit message
-
[BUGFIX] TCA l10n_mode exclude (as well as allow language syncronisation bahviour) and bidirectional MM relations cause Extbase to use uidLocalized instead of UID from foreign side Resolves: #92777 Releases: main
Related issues 3
History 918
-
Marc Hirdes commented <span data-processor="relativetime" data-value="2022-04-21T09:09:40+00:00" > 04/21/22, 09:09 </span>
MM_oppositeUsage has no effect
-
Maik Kempe commented <span data-processor="relativetime" data-value="2022-05-18T19:40:31+00:00" > 05/18/22, 19:40 </span>
Unfortunately I have exactly the same problem as Marc with a project running TYPO3 10.4. I think the problem is the update of the relations from the other side with an `MM_opposite_field` option. On the side without the `MM_opposite_field` option it works in the backend and also in the frontend (Extbase) for all languages. With a save or update in the backend all relations for languages other than the default language are being broken in the frontend (Extbase). Currently our solution is to disable the columns with an `MM_opposite_field` option.
-
Maik Kempe changed Related to #90430 <span data-processor="relativetime" data-value="2022-05-18T19:49:53+00:00" > 05/18/22, 19:49 </span>
-
Gerrit Code Review pushed patch set 18 for main to change 67172 status
NewUnder Review <span data-processor="relativetime" data-value="2024-03-17T11:43:01+00:00" > 03/17/24, 11:43 </span> -
Gerrit Code Review pushed patch set 19 for main to change 67172 <span data-processor="relativetime" data-value="2024-03-17T12:02:59+00:00" > 03/17/24, 12:02 </span>
-
Gerrit Code Review pushed patch set 20 for main to change 67172 <span data-processor="relativetime" data-value="2024-03-17T12:23:54+00:00" > 03/17/24, 12:23 </span>
-
Gerrit Code Review pushed patch set 21 for main to change 67172 <span data-processor="relativetime" data-value="2024-03-17T12:24:37+00:00" > 03/17/24, 12:24 </span>
-
Gerrit Code Review pushed patch set 22 for main to change 67172 <span data-processor="relativetime" data-value="2024-03-24T09:07:12+00:00" > 03/24/24, 09:07 </span>
-
Gerrit Code Review pushed patch set 23 for main to change 67172 <span data-processor="relativetime" data-value="2024-03-24T13:42:38+00:00" > 03/24/24, 13:42 </span>
-
Gerrit Code Review pushed patch set 24 for main to change 67172 <span data-processor="relativetime" data-value="2024-03-24T14:24:29+00:00" > 03/24/24, 14:24 </span>
-
Gerrit Code Review pushed patch set 25 for main to change 67172 <span data-processor="relativetime" data-value="2024-03-24T14:41:54+00:00" > 03/24/24, 14:41 </span>
-
S P commented and changed subject
TCA l10n_mode exclude and MM relationsTCA l10n_mode exclude (as well as allow language syncronisation bahviour) and bidirectional MM relations cause Extbase to use uidLocalized instead of UID from foreign side TYPO3 Version1011 PHP Version7.38.1 <span data-processor="relativetime" data-value="2024-08-02T09:30:52+00:00" > 08/02/24, 09:30 </span>If Extbase encounters
MM_opposite_fieldit simply switchesuid_localanduid_foreign. So far so correct. However, in MM tables the core stores on the foreign side always the L=0 uid, if overlaying is used . So far so still correct.And
Typo3DbQueryParser->createTypedNamedParameterdoes this:if ($value instanceof AbstractDomainObject && $value->_hasProperty('_localizedUid') && $value->_getProperty('_localizedUid') > 0 ) { $plainValue = (int)$value->_getProperty('_localizedUid'); }So it uses the L>0 uid, so far so only correct as long as it is no bidirectional relation from the foreign side.
This is the place where it gets wrong: If a bidirectional relation is encountered from the foreign side (i.e.
MM_opposite_fieldis present), then this method must use theuidand not the_localizedUid.The patch in here would change DataHandler behaviour. However, for the bug in this ticket, only Extbase needs to correctly detect bidirectional language overlays (e.g. use the
uidfrom foreign side, instead of_localizedUid). This is a pure Extbase bug, not a core bug. -
Gerrit Code Review pushed patch set 26 for main to change 67172 <span data-processor="relativetime" data-value="2024-10-18T13:41:10+00:00" > 10/18/24, 13:41 </span>
-
Benni Mack changed Related to #108986 <span data-processor="relativetime" data-value="2026-02-15T17:18:38+00:00" > 02/15/26, 17:18 </span>
-
Benni Mack changed status
Under ReviewNew <span data-processor="relativetime" data-value="2026-11-09T11:27:23+00:00" > 11/09/26, 11:27 </span> -
Benni Mack changed Related to #100002 <span data-processor="relativetime" data-value="2026-11-18T19:41:05+00:00" > 11/18/26, 19:41 </span>
Did not test it, but maybe using
MM_oppositeUsageforproduct(https://docs.typo3.org/m/typo3/reference-tca/10.4/en-us/ColumnsConfig/Type/Group.html#mm-oppositeusage) might help…