95445[BUGFIX] Respect l10n_mode exclude in Extbase
Commit message
Test this change
Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch
- Check out patch set 9
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/45/95445/9 && git checkout FETCH_HEAD - Cherry-pick onto main
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/45/95445/9 && git cherry-pick FETCH_HEAD
Review
-
Code review CR 0 Needs a vote
-
Verified V 0 Needs a vote
- core-ci +1 CI
Relation chain 2
- main 96671[TASK] Test Extbase against DataHandler for l10n_mode exclude
-
95445 [BUGFIX] Respect l10n_mode exclude in Extbase This change
Merge conflicts 8
- main 96845[!!!][TASK] Move Extbase dirty tracking into the persistence layer
- main 96722[BUGFIX] Delete the former child of a 1:1 relation in Extbase
- main 96543[WIP][POC][TASK] Write and read records by the same rules and rights
- main 95162[BUGFIX] Handle empty dates consistently in Extbase
- main 96533[WIP][!!!][TASK] Build Extbase persistence on doctrine/orm
- main 88948[!!!][TASK] Refactor Property Handling in AbstractDomainObject
- main 92366[BUGFIX] Synchronize inline relation pids when parent pid changes
- main 79450[WIP][BUGFIX] Cascade remove will also remove hidden childs
Issues 2
Files 6
- typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMap.php+2 −0
- typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php+9 −0
- typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php+42 −0
- typo3/sysext/extbase/Tests/Functional/Persistence/ExcludedFromTranslationReadTest.php+2 −2
- typo3/sysext/extbase/Tests/Functional/Persistence/ExcludedFromTranslationWriteDefaultRecordTest.php+9 −15
- typo3/sysext/extbase/Tests/Functional/Persistence/ExcludedFromTranslationWriteTranslationTest.php+5 −11
Review log 1624
-
Benjamin Kott uploaded patch set 1 08/27/26, 06:43
-
Benjamin Kott wrote 10/08/26, 07:58
Unset private -
Benjamin Kott updated the commit message in patch set 2 10/08/26, 07:58
-
core-ci voted on patch set 2 V +1 10/08/26, 08:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110469
-
Benjamin Kott uploaded patch set 3
V +110/08/26, 09:07 -
Benjamin Kott updated the commit message in patch set 4 10/08/26, 09:11
-
core-ci voted on patch set 3 V +1 10/08/26, 09:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110470
-
core-ci voted on patch set 4 V +1 10/08/26, 09:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110471
-
Andreas Kienast uploaded patch set 5
V +110/10/26, 19:34 -
core-ci voted on patch set 5 V -1 10/10/26, 19:42 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110817
-
Andreas Kienast rebased onto patch set 6
V -110/10/26, 20:08 -
core-ci voted on patch set 6 V +1 10/10/26, 20:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110819
-
Alexander Schnitzler commented on patch set 6 V -1 10/13/26, 19:32
Hi folks, fundamental question here: Should Extbase behave like DataHandler for fields with l10n_mode = exclude? I'm asking because the patch follows DataHandler for parent values, but not for children. Parent values (e.g. author): The patch fixes the write side. Extbase now writes the value to the default language record and all its translations, as DataHandler's DataMapProcessor does. Children of an excluded relation (inline, and type=file too): Here the patch changes the read side instead of the write side. DataHandler gives every translation its own copy of each child of an excluded relation, attached to the translation (DataMapProcessor.php:598-642). Core reads a translation's children from these copies: the Record API (RelationResolver.php:124-125) and FileCollector (FileCollector.php:290-294) both use the localized uid. Extbase does the same today. The patch doesn't create these copies when Extbase writes. Instead, Extbase now reads the children of the default language record. Reading a translated post, the Record API and Extbase on main both return the copied comment attached to the translation, while Extbase with this patch returns the original comment attached to the default language record. So Extbase would no longer read a translation's children the way DataHandler stores them and the rest of core reads them. This also applies to data written by DataHandler alone, not only to children added through Extbase. If Extbase is meant to behave like DataHandler, I'd suggest keeping the read side unchanged and creating the copies when writing, as DataHandler does. Side note on sys_history: The values written to the translations by synchronizeColumnsExcludedFromTranslation() bypass the persistence events, so ExtbaseHistoryTracker records no history for them. DataHandler writes one entry per translation. I've put these cases into tests that expect DataHandler's behaviour, in a change on top of this one: https://review.typo3.org/c/Packages/TYPO3.CMS/+/96671 -> https://git.typo3.org/typo3/CI/cms/-/pipelines/111022 main this patch Extbase reads the copy attached to the translation ok FAIL Excluded value is written to the translations - changed on the default language record FAIL ok - changed through a translation FAIL ok Every changed record gets a history entry FAIL FAIL A new child is copied to the translations - added to the default language record FAIL FAIL - added through a translation FAIL FAIL DataHandler doesn't allow changing an excluded field through a translation. For those two cases, the tests expect the same result as a change on the default language record. -
Alexander Schnitzler commented on patch set 6 V 0 CR -1 10/13/26, 19:39
Reply
Sorry, the table above is misleading: "FAIL" only means "differs from DataHandler", not a CI failure or a regression caused by this patch. Here is the same comparison by behaviour: ``` DataHandler Extbase main Extbase + patch Children read for a its own copies its own copies children of the translation default record Value changed on the all records default record all records default record only Value changed through not allowed translation all records a translation only History for synced yes - no translations New child on the copied to the no copies no copies default record translations New child through a not allowed attached to attached to the translation translation default record, no copies ``` So the patch fixes the excluded values (rows 2 and 3), changes how children are read (row 1), and leaves out the history and the copies (rows 4 to 6). -
Alexander Schnitzler rebased onto patch set 7
CR -1V +110/18/26, 13:22 -
core-ci voted on patch set 7 V -1 10/18/26, 13:35 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111520
-
Alexander Schnitzler uploaded patch set 8
V -110/18/26, 13:39 -
Alexander Schnitzler commented on patch set 8 CR -1 10/18/26, 13:46
One more thing here I missed. Usually Backend does not use a Connection directly but asks the Typo3DbBackend. I am currently checking how to implement it that way. -
Alexander Schnitzler commented on patch set 8 10/18/26, 13:46
Reply
Done -
core-ci voted on patch set 8 V +1 10/18/26, 13:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111524
-
Alexander Schnitzler commented on patch set 8 CR 0 10/18/26, 14:13
Reply Unresolved
A note on the direct query in Backend::synchronizeColumnsExcludedFromTranslation(): Backend now selects the uids of the live translations itself through the ConnectionPool. So far, only the storage layer queries the database in Extbase's persistence. Moving the query there would need a new method on Storage\BackendInterface. That interface is public API, so the change would be breaking on main and is not possible for 14.3, where this fix should go as well. Fetching the translations with an Extbase query instead (createQueryForType() and getObjectDataByQuery()) works, but changes which translations are found: - Without an overlay, the uid of a translation row is replaced by its l10n_parent; the real uid has to be read from _LOCALIZED_UID. - In a workspace, versionOL() still runs and drops translations that are delete placeholders there, so they would not be synchronized. - createQueryForType() adds the record type constraint of the class, so a translation with another record type would be skipped. The direct query states exactly what DataHandler does: all live rows whose l10n_parent is the default language record. Therefore I opt for KISS here. Let's break the public API when we actually need to. -
Alexander Schnitzler commented on patch set 8 10/18/26, 14:18
What patch set 8 removes compared to patch set 6, and why: 1. Children of excluded relations. Patch set 6 read the children of an excluded inline relation from the default language record, and attached a child added through a translation to the default language record. Both are gone; children behave as on main. - DataHandler keeps one copy of each child per translation (DataMapProcessor), and the Record API and FileCollector read a translation's children from these copies. With patch set 6, Extbase would have read differently from DataHandler and the rest of core, also for data written by DataHandler alone. Patch set 7 (the plain rebase) shows it: ExcludedFromTranslationWriteTranslationTest::commentRemovedThroughTheTranslationRemovesOnlyTheCopyOfTheTranslationByExtbase, green on main, turns red. - How excluded children should behave is not settled in core. In change https://review.typo3.org/c/Packages/TYPO3.CMS/+/88837 the current copy behaviour is kept explicitly as an interim state ("we have no good sync at the moment"), the translation handling initiative asks for copies in all translations, and others question syncing them at all. #104489 states that "the expected behaviour of l10n_mode=exclude with relations is not entirely clear". So we leave children out of this fix; the remaining tests in the merged suite stay skipped and point to #111126. 2. The patch's own test class and fixtures. The paired suite merged with change https://review.typo3.org/c/Packages/TYPO3.CMS/+/96683 covers the same cases against DataHandler. This patch now removes the skips of the tests it fixes there instead of adding a second suite. 3. A value set through a translation. Patch set 6 wrote it to the default language record and all translations. DataHandler drops it, as the merged ...ThroughATranslationIsDropped tests expect, so Extbase now drops it too. History entries for the synchronized translations are not written yet: Extbase's history tracker works on domain objects, and the translations updated here have none. That test stays skipped as well. -
Alexander Schnitzler uploaded patch set 9
V +111/11/26, 09:13 -
core-ci voted on patch set 9 V +1 11/11/26, 09:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114027