extension_builder
extension_builder copied to clipboard
Adjust generated foreign_table_where for multilanguage relations
With 9 LTS and at least 10 LTS, relations in translated records must always point to the translated record. Before that, it was possible that the relation field of a translated record pointed to the record in original record (it was not neccessary to "translate" the relation itself).
Background information:
https://review.typo3.org/c/Packages/TYPO3.CMS/+/43147/ "The backend expects the localized uid as parent id but extbase currently saves the original uid"
https://docs.typo3.org/m/typo3/book-extbasefluid/master/en-us/9-CrosscuttingConcerns/1-localizing-and-internationalizing-an-extension.html#typo3-v9-and-higher
As many developers seem not to now about the current behaviour, the auto generated "foreign_table_where" statements should be extended to only retrieve records for the current language like this:
AND (tx_ext_domain_model_thing.sys_language_uid=###REC_FIELD_sys_language_uid### OR tx_ext_domain_model_thing.sys_language_uid = -1)
There is also already a related record regarding the translations things:
https://forge.typo3.org/issues/90430