extbase: strict mode and bug with queries in regards addSysLanguageStatement - e.g. contains ignores different MM translations
If one uses addSysLanguageStatement with strict mode the generated statement is incorrect.
The reason is that if I use not strict, the translated record is selected if one exist.
If I use strict I only seem to select the translated record IF there is not parent record to it, otherwise I select the parent record If there is a corresponding translations.
This means that for instance if I use a query with "contains" that has different relations in the child record, it still uses the translations of the parent record.
This might also be the case for different translations.
#2 Updated by Andreas Kiessling over 4 years ago
I don't think Andreas is talking about SQL strict mode, but rather config.sys_language_mode.
Extbase and multilanguage is tricky since there are so many config options to consider. I always try to avoid having different relations in translated records. You might want to have a look at "$query->getQuerySettings()->setLanguageMode(..)" to change the language mode on specific queries
#3 Updated by Andreas Allacher over 4 years ago
Yes. I mean config.sys_language_mode
And this ticket is actually for the new "LanguageMode" setting in extbase. If that is set to "strict".
There is the issue with how the records are retrieved.
I only retrieve the translated records if there is no parent record, otherwise extbase gets the parent record and translates that one.
Which, of course, kind of invalidates the usage of strict. After all this might "destroy" ordering and as mentioned it uses the translations in the MM table of the language parent.
Sorry for the delay. Forgot to mark the issue as "Watch" and therefore got no notification.
#9 Updated by Andreas Allacher about 4 years ago
This is for instance an issue if you have the following:
$records = [ [ 'uid' => 1, 'title' => 'a', 'sys_language_uid' => 0 ], [ 'uid' => 2, 'title' => 'b', 'sys_language_uid' => 0 ], [ 'uid' => 3, 'title' => 'b', 'sys_language_uid' => 1, 'l10n_parent' => 1 ], [ 'uid' => 4, 'title' => 'a', 'sys_language_uid' => 1. 'l10n_parent' => 2 ], ]
Now if I search for records in sys_language_uid = 1 and order by title, I will get
the records with UID 3 and then 4, whereas one would expect 4 and then 3.