Issue Feature Closed

#94539Documentation on how to work with 1:n and n:1 relations and translations

Rozbeh Chiryai Sharahi 07/12/21, 07:59 updated 10/01/26, 09:09

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.

History 13

  1. Rozbeh Chiryai Sharahi commented and changed subject Docs: Improve documentation on extbase-localization regarding 1:n relations Documentation 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>

    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

  2. Garvin Hicking commented and changed status New Needs 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.

  3. Garvin Hicking commented and changed status Needs Feedback Closed <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?

  4. 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

  5. Lina Wolf commented and changed status Accepted Closed <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-relations

    The 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/7171

    Closing this issue here, please follow up on GitHub.