71094[BUGFIX] No MM relations when localizing categories
Commit message
Review
-
Code review CR +2 Done
- Benni Mack +2
- Oli Bartsch +1
- Jochen Roth +1
-
Verified V +2 Done
- Benni Mack +2
- Oli Bartsch +1
- Jochen Roth +1
- core-ci +1 CI
Issues 6
- Bug #89659Translating a record creates superfluous wrong mm relations
- Bug #89620Creating MM relations in a group field with a translatable table causes translated records to show up twice
- Bug #91842Entries in sys_category_record_mm are created also for translated categories
- Bug #77902Translating category causes creation of non-necessary relations
- Bug #70460Categories for translated pages/categories get lost
- Bug #62727Allow MM reference translation on non inline fields for bidirectional MM relations
Files 10
- typo3/sysext/core/Classes/DataHandling/DataHandler.php+6 −0
- typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/copyCategoryToLanguageOfRelation.csv+1 −3
- typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/createCategoryAndAddRelation.csvnew+37 −0
- typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/localizeCategoryOfRelation.csv+1 −3
- typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/Modify/ActionTest.php+15 −6
- typo3/sysext/core/Tests/Functional/DataHandling/ManyToMany/AbstractActionTestCase.php+21 −0
- typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Modify/DataSet/localizeCategoryOfRelation.csv+1 −3
- typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/Publish/DataSet/localizeCategoryOfRelation.csv+1 −3
- typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/PublishAll/DataSet/localizeCategoryOfRelation.csv+1 −3
- typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/AbstractActionTestCase.php+0 −10
Review log 810
-
Christian Kuhn uploaded patch set 1 09/15/21, 17:59
-
core-ci voted on patch set 1 V +1 09/15/21, 18:13 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16753
-
Christian Kuhn updated the commit message in patch set 2 09/15/21, 18:46
-
core-ci voted on patch set 2 V +1 09/15/21, 19:01 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16758
-
Jochen Roth voted on patch set 2 V +1 CR +1 09/15/21, 19:57
-
Oli Bartsch voted on patch set 2 V +1 CR +1 09/15/21, 21:48
-
Markus Klein commented on patch set 2 09/16/21, 09:17
Without having dug deeply, a few questions: * Does that mean we only store relation to the default language category from now on? * Isn't that breaking for any extension that relied on the current records? * Isn't this actually a workaround for the fact the the MM relation table for sys_category is actually wrong in the terms of the definition of an MM in TYPO3? The category is actually always the foreign side for any other entity. Correct would be to relate tt_content as local side to a sys_category on the foreign side. Localizing the local side would then make the behaviour correct as the translations would get their relation to the category. Maybe the whole thing is way more complicated than this fix suggests. I cannot judge this so easily. I suspect that this might break things for other MM relations in extensions. (no example at hand currently though) -
Christian Kuhn commented on patch set 2 09/16/21, 13:34
Reply
> * Does that mean we only store relation to the default language category from now on? No. Of course not! There are further bugs, but in the end, a localized tt_content or page record connection to a localized category should have an mm table entry with exactly these uid's in them. Other relations like inline foreign field and inline csv do the same: They reference the localized records. We did that a couple of version ago already and MM should follow with this strategy. > * Isn't that breaking for any extension that relied on the current records? No. The only change is, as i tried to explain in the commit message: You have a default lang tt_content element, connected to a default lang sys_category record -> 1 mm entry. Good. Then the category is localized, which adds an *additional* mm record from the not-localized tt_content to the just localized category. That's of course broken. See the "Resolved" issues, they explain this with different wordings, too. There are further broken scenarios when for instance connecting a localized tt_content to a already localized category, those are broken, too, but they'll be further patches and they may need interface adaptions to be more visible, too. For now, this patch simply takes care that no surplus mm row is written when localizing the local side of a relation, since that leads to various issues for instance in the frontend where categories then tend to be rendered twice. The tests (should?!) verify the patch impacts exactly only this scenario, that's also why the code change is within the localize() method of DH and not within RelationHandler where i tried it first and recognized that creates too much not wanted impact. > * Isn't this actually a workaround for the fact the the MM relation table for sys_category is actually wrong in the terms of the definition of an MM in TYPO3? The category is actually always the foreign side for any other entity. Correct would be to relate tt_content as local side to a sys_category on the foreign side. Localizing the local side would then make the behaviour correct as the translations would get their relation to the category. well. sys_category is uid_local in mm, that's why it's 'local' side from code point of view. i also think that's kinda ok'ish, since many foreign tables link to the one local category table. from this point, sys_category "local" is "the one" and foreign are "the others". it's kinda core internal thinking and does not match that too much for an editor, though. > I suspect that this might break things for other MM relations in extensions. (no example at hand currently though) Don't know how this is breaking. -
Benni Mack voted on patch set 2 V +2 CR +2 09/16/21, 15:14
-
Benni Mack merged patch set 3 09/16/21, 15:14