Bug #75810
closedExtbase fails to properly matching a value against a non-translated property
0%
Description
Description¶
If you create an Extbase query (\TYPO3\CMS\Extbase\Persistence\Generic\Query) and filter by a property which has "l10n_mode" => exclude it will still try to match the property to the translated records instead of the parents.
Extbase should filter out records with a language parent at this stage of the query, since it does the record overlay afterwards in any case.
Steps to reproduce¶
(I've attached an extension which demonstrates the issue)
- Have a TYPO3 installation with at least 2 languages
- Install the provided extension (attached to the ticket)
- Create a record with the value "test" in the field "Nontranslatedproperty"
- Translate that record
- Add the plugin on any page
- Run the plugin on any sys_language other than default
Expected result¶
Example 1:
$query = $this->testMasterRepository->createQuery(); $query->matching( $query->equals('nontranslatedproperty', 'test') ); $test = $query->execute();
Should return the record with "nontranslatedproperty" => "test"
Actual result¶
Doesn't return the expected record in any sys_language other than 0/-1
Example which returns the expected result¶
$query = $this->testMasterRepository->createQuery(); $querySettings = $query->getQuerySettings(); $querySettings->setRespectSysLanguage(false); $query->setQuerySettings($querySettings); $query->matching( $query->logicalAnd( $query->logicalOr( $query->in('sys_language_uid', [0, -1]), $query->logicalAnd( $query->equals('sys_language_uid', $querySettings->getLanguageUid()), $query->equals('l10n_parent', 0) ) ), $query->equals('nontranslatedproperty', 'test') ) ); $test = $query->execute();
Files
Updated by Nicole Cordes over 8 years ago
- Status changed from New to On Hold
I can understand and verify your problem. But currently it seems, as this issue is not solvable in Extbase as it doesn't check the l10n_mode defined in the TCA settings of the table. And respecting this setting is not that easy as you can insert a nested property in the query clause.
I would suggest to use your example query as you know the state of the l10n_mode of that field.
Updated by Helmut Hummel over 8 years ago
Thanks for the detailed report!
Nicola Heisch wrote:
Extbase should filter out records with a language parent at this stage of the query, since it does the record overlay afterwards in any case.
We cannot do so, because this will break ordering statements on translated properties.
My suggestion would be to add a DataHandler hook, which keeps translated fields in sync with the translation parent, if they are configured as l10n_mode exclude.
This would also be the only possible fix we could incorporate without blowing up the SQL statement
Updated by Benni Mack over 8 years ago
- Target version changed from 7.6.5 to Candidate for patchlevel
Updated by Riccardo De Contardi about 7 years ago
- Category changed from Extbase to Extbase + l10n
Updated by Benni Mack about 7 years ago
- Status changed from On Hold to Needs Feedback
With the new data synchronization logic in v8 LTS this is now possible to solve this conceptual issue. Can you please confirm if this also solves your problem?
Updated by Wouter Wolters almost 7 years ago
- Status changed from Needs Feedback to Closed
Closed for lack of feedback after more than 3 months. Should be solved according to Benni.