#94539Documentation on how to work with 1:n and n:1 relations and translations
Description
While in TYPO3 v8 it was possible to assign relations via default-language-uid, on v9 this is not possible anymore.
Given following example:
Car-table:
uid: 1, name: Some Car uid: 2, name: Some Car (translation), l10n_parent: 1, sys_language_uid: 1, l10n_parent:1
Owner-table
uid: 1, name: Robert, car: 1 uid: 2, name: Robert (translation), car: 1, sys_language_uid: 1, l10n_parent: 1
Here we are pointing even the translation of Robert to the default language. This was working well in TYPO3 v8 when querying on Extbase for translations:
$query->eq(‘car.owners.name’, ‘Robert’)
Nevertheless on v9 this query will not work anymore, instead we have to point relations to the translated ID. This is related to the LEFT-JOIN and WHERE clause that is created.
SELECT * FROM car LEFT JOIN owner ON car.id = owner.car WHERE car.sys_language_uid=1 -- This can not work in combination with left join of tables where translations are pointing to default language AND owner.name='Robert'
Conclusion/Suggestion
None of the languageOverlayModes (true, false, ‘hideNotTranslated’) is compatible with relations that point to original languages, therefore I think this should be stated somewhere. In general there seems to be a lack of extbase translation documentation. Am I right?
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Related issues 5
- Bug #89768l10n_mode "exclude" does not work with inline type
- Bug #90430Language handling of bidirectional mm selects is not consitent.
- Bug #102336Add support for localizing n:1 relations
- Bug #105843Language fallback broken for objectstorages
- Epic #108986Improve MM handling in TYPO3 Core related to language + workspace concepts
History 13
-
Rozbeh Chiryai Sharahi commented and changed subject
Docs: Improve documentation on extbase-localization regarding 1:n relationsDocumentation on how to work with 1:n and n:1 relations and translations <span data-processor="relativetime" data-value="2021-07-12T12:47:44+00:00" > 07/12/21, 12:47 </span> -
Benni Mack changed is private <span data-processor="relativetime" data-value="2024-06-20T10:37:46+00:00" > 06/20/24, 10:37 </span>
-
Garvin Hicking commented and changed status
NewNeeds Feedback <span data-processor="relativetime" data-value="2024-06-20T12:06:26+00:00" > 06/20/24, 12:06 </span>Is this still something you’re interested in? Maybe we can find acceptable ways of documenting this together.
-
Garvin Hicking commented and changed status
Needs FeedbackClosed <span data-processor="relativetime" data-value="2024-12-22T22:21:23+00:00" > 12/22/24, 22:21 </span>Closing this due to lack of feedback. I still believe this could be worthwile to tackle, maybe better though created as in issue in the github doc tracker for the core-api “TYPO3 Explained” docs?
-
Jan Kornblum changed Related to #105843 <span data-processor="relativetime" data-value="2025-01-07T11:12:27+00:00" > 01/07/25, 11:12 </span>
-
Jan Kornblum changed Related to #89768 <span data-processor="relativetime" data-value="2025-01-07T11:12:44+00:00" > 01/07/25, 11:12 </span>
-
Jan Kornblum changed Related to #102336 <span data-processor="relativetime" data-value="2025-01-07T11:13:47+00:00" > 01/07/25, 11:13 </span>
-
Jan Kornblum commented <span data-processor="relativetime" data-value="2025-01-07T11:21:50+00:00" > 01/07/25, 11:21 </span>
Please reopen… This is still not documented in any good way and since v9 it is hard to find out how a setup (tca + extbase) is intended to be, especially for 1:n or n:1 relations, e.g. see https://forge.typo3.org/issues/90430#note-7 or https://forge.typo3.org/issues/90430#note-14
-
Jan Kornblum changed status
ClosedNew <span data-processor="relativetime" data-value="2025-01-07T11:22:16+00:00" > 01/07/25, 11:22 </span> -
Georg Ringer changed status
NewAccepted <span data-processor="relativetime" data-value="2025-01-07T13:58:25+00:00" > 01/07/25, 13:58 </span> -
Jan Kornblum changed Related to #90430 <span data-processor="relativetime" data-value="2025-01-07T18:37:22+00:00" > 01/07/25, 18:37 </span>
-
Benni Mack changed Related to #108986 <span data-processor="relativetime" data-value="2026-02-15T17:19:24+00:00" > 02/15/26, 17:19 </span>
-
Lina Wolf commented and changed status
AcceptedClosed <span data-processor="relativetime" data-value="2026-10-01T09:09:06+00:00" > 10/01/26, 09:09 </span>The topic is currently being documented in TYPO3 Explained. The reworked Extbase chapters already cover how relations are loaded across languages:
https://docs.typo3.org/permalink/t3coreapi:extbase-localisation
https://docs.typo3.org/permalink/t3coreapi:extbase-persistence-relationsThe two questions from this issue that are not answered there yet (where relations of translated records should point, and constraints on properties of related objects) are now tracked in the documentation repository:
https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-CoreApi/issues/7171Closing this issue here, please follow up on GitHub.
Hello,
it would be nice to add a language/localization/translation section to https://docs.typo3.org/m/typo3/book-extbasefluid/master/en-us/6-Persistence/3-implement-individual-database-queries.html.
It is currently not possible to research how TYPO3 wants relations to be set. For instance with version 9 the language handling has changed and with that the queries created by EXTBASE.
This came to my mind when i tried to find out how TYPO3 wants relations of translations to be set. Shall they point to default language? Shall they point to translated records? Searching in the docs was successless.
It would be nice to have a documentation on how queries are build regarding language settings. Similar to this one:
https://docs.typo3.org/m/typo3/book-extbasefluid/master/en-us/6-Persistence/3-implement-individual-database-queries.html#n-relation-has-many
Why would this be important imo:
Taking the relations of TYPO3 as an example:
On TCA we can configure freely if we want our relations to point to translations or to default languages.
1) foreign_table_where => ‘AND record.sys_language_uid=0’
2) foreign_table_where => ‘AND record.sys_language_uid=###CURRENT_LANGUAGE###’
Nevertheless on extbase only 2) is an option in order to do statements like:
$query->matching($query->equals(‘child.title’,‘some title’));
In TYPO3 v8 1) & 2) would work, but on v9 not, since the queries is created as following
SELECT * FROM record
LEFT JOIN child ON record.uid = child.parent
WHERE child.title=‘some title’
AND record.sys_language_uid=1 <— if we filter the select by sys_lang=1 this means pointing to default lang on child is no longer possible