这与此问题基本相同,但现在对于TYPO3 8: get TYPO3 Extbase Repository items in other languages
https://forge.typo3.org/issues/45873中提到的解决方法不起作用 在v8对我来说。它始终以默认语言返回项目。
有没有人有适当的例子?
public function findTranslation($obj, $languageUid){
$query = $this->createQuery();
$query->matching(
$query->logicalAnd(
$query->equals("l10n_parent", $course->getUid()),
$query->equals("sys_language_uid",$languageUid)
)
);
$result = $query->execute();
return $result;
}
我尝试了什么
暂时覆盖存储库中的TCA languageField
public function findTranslation($obj, $languageUid){
$query = $this->createQuery();
$languageField = $GLOBALS['TCA']['tx_extensionname_domain_model_table']['ctrl']['languageField'];
unset($GLOBALS['TCA']['tx_extensionname_domain_model_table']['ctrl']['languageField']);
$query->matching(
$query->logicalAnd(
$query->equals("l10n_parent", $course->getUid()),
$query->equals("sys_language_uid",$languageUid)
)
);
$GLOBALS['TCA']['tx_extensionname_domain_model_table']['ctrl']['languageField'] = $languageField;
$result = $query->execute();
return $result;
}
这个工作单在https://forge.typo3.org/issues/45873
找到 $GLOBALS['TCA']['tx_extensionname_domain_model_table']['ctrl']['transOrigPointerTable'] = '';
这个黑客发现于forge.typo3.org/issues/45873#note-27(CustomDataMapper)