Bug #88887
closedDataMapper: Don't pass language -1 to child query using consistentTranslationOverlayHandling
0%
Description
Given:¶
The new feature "consistentTranslationOverlayHandling" is enabled.
There is an unlocalizable record (sys_language_uid = -1) which has a relation to a localizable record.
Problem:¶
At the moment the language of the parent record is passed to the relation's query to get correct overlays if e.g. the parent record's language doesn't equal the language of the parent query (page language).
However, this shouldn't be done, if the parent record's language is 1, because in this case we still want to use the language UID of the parent query. Otherwise $pageRepository>getRecordOverlay() in Typo3DbBackend::overlayLanguageAndWorkspace won't overlay the child record as expected.
Solution:¶
Don't do it if the language is -1.¶
sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php:
444 444 protected function getPreparedQuery(DomainObjectInterface $parentObject, $propertyName, $fieldValue = '') 445 445 { 446 446 $dataMap = $this->getDataMap(get_class($parentObject)); 447 447 $columnMap = $dataMap->getColumnMap($propertyName); 448 448 $type = $this->getType(get_class($parentObject), $propertyName); 449 449 $query = $this->queryFactory->create($type); 450 450 if ($this->query && $query instanceof Persistence\Generic\Query) { 451 451 $query->setParentQuery($this->query); 452 452 } 453 453 $query->getQuerySettings()->setRespectStoragePage(false); 454 454 $query->getQuerySettings()->setRespectSysLanguage(false); 455 455 456 456 if ($this->configurationManager->isFeatureEnabled('consistentTranslationOverlayHandling')) { 457 457 //we always want to overlay relations as most of the time they are stored in db using default lang uids 458 458 $query->getQuerySettings()->setLanguageOverlayMode(true); 459 459 if ($this->query) { 460 460 $query->getQuerySettings()->setLanguageUid($this->query->getQuerySettings()->getLanguageUid()); 461 461 462 462 if ($dataMap->getLanguageIdColumnName() !== null && !$this->query->getQuerySettings()->getRespectSysLanguage()) { 463 463 //pass language of parent record to child objects, so they can be overlaid correctly in case 464 464 //e.g. findByUid is used. 465 465 //the languageUid is used for getRecordOverlay later on, despite RespectSysLanguage being false 466 466 $languageUid = (int)$parentObject->_getProperty('_languageUid'); 467 - $query->getQuerySettings()->setLanguageUid($languageUid); 467 + //Don't do it if the parent's language is "All" because language overlay wouldn't work anymore 468 + if ($languageUid !== -1) { 469 + $query->getQuerySettings()->setLanguageUid($languageUid); 470 + } 468 471 } 469 472 } 470 473 }
Updated by Matthias Meusburger about 5 years ago
- Category changed from Extbase to Extbase + l10n
Updated by Matthias Meusburger about 5 years ago
- Subject changed from DataMapper: Don't pass language -1 to child query to DataMapper: Don't pass language -1 to child query using consistentTranslationOverlayHandling
Updated by Matthias Meusburger about 5 years ago
- Has duplicate Bug #89133: DataMapper: Don't pass language -1 to child query using consistentTranslationOverlayHandling added
Updated by Susanne Moog almost 5 years ago
- Sprint Focus set to On Location Sprint
Updated by Kevin Ditscheid over 3 years ago
I also ran into this in TYPO3 10.4.15 with the powermail plugin wanting to display mails in their backend plugin preview while one of the mails had -1 as its sys_language_uid.
Updated by Oliver Hader about 2 years ago
- Sprint Focus deleted (
On Location Sprint)
Updated by Benni Mack about 1 year ago
- Related to Bug #92768: Extbase: Localized Children records are not working when parent element has sys_language_uid=-1 added
Updated by Benni Mack about 1 year ago
- Status changed from New to Closed
I think this is fixed with #92768 - if you feel this is the wrong decision, let me know and I will re-open the issue.