Project

General

Profile

Actions

Bug #92777

open

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

Added by Marc Hirdes about 4 years ago. Updated about 1 month ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2020-11-05
Due date:
% Done:

0%

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

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


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Bug #90430: Language handling of bidirectional mm selects is not consitent.Under Review2020-02-19

Actions
Actions #1

Updated by Oliver Hader over 3 years ago

Did not test it, but maybe using MM_oppositeUsage for product (https://docs.typo3.org/m/typo3/reference-tca/10.4/en-us/ColumnsConfig/Type/Group.html#mm-oppositeusage) might help...

Actions #2

Updated by Marc Hirdes over 2 years ago

MM_oppositeUsage has no effect

Actions #4

Updated by Maik Kempe over 2 years ago

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.

Actions #5

Updated by Maik Kempe over 2 years ago

  • Related to Bug #90430: Language handling of bidirectional mm selects is not consitent. added
Actions #6

Updated by Gerrit Code Review 8 months ago

  • Status changed from New to Under Review

Patch set 18 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67172

Actions #7

Updated by Gerrit Code Review 8 months ago

Patch set 19 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67172

Actions #8

Updated by Gerrit Code Review 8 months ago

Patch set 20 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67172

Actions #9

Updated by Gerrit Code Review 8 months ago

Patch set 21 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67172

Actions #10

Updated by Gerrit Code Review 8 months ago

Patch set 22 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67172

Actions #11

Updated by Gerrit Code Review 8 months ago

Patch set 23 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67172

Actions #12

Updated by Gerrit Code Review 8 months ago

Patch set 24 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67172

Actions #13

Updated by Gerrit Code Review 8 months ago

Patch set 25 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67172

Actions #14

Updated by S P 4 months ago ยท Edited

  • Subject changed from TCA l10n_mode exclude and MM relations to 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
  • TYPO3 Version changed from 10 to 11
  • PHP Version changed from 7.3 to 8.1

If Extbase encounters MM_opposite_field it simply switches uid_local and uid_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->createTypedNamedParameter does 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_field is present), then this method must use the uid and 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 uid from foreign side, instead of _localizedUid). This is a pure Extbase bug, not a core bug.

Actions #15

Updated by Gerrit Code Review about 1 month ago

Patch set 26 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67172

Actions

Also available in: Atom PDF