Bug #60501
closedLocalization in CLI/BE mode
0%
Description
There is a non-obvious and hacky behaviour, when developer tries to work with Extbase objects in CLI mode (and, probably, BE as well).
The problem is in fact, that using ->setSysLanguageUid($language) on query settings of Repository helps, but only for 1st level object. Child objects are non-localized in CLI mode.
Example:
$languageUid = 7; // $parents contain correct translations (language=7) $parents = $parentRepository->findAll($languageUid); foreach($parents as $parent) { // $child doesn't contain correct translation (language=0) $child = $parent->getChild(); }
This can be "solved" in following way.
First you need to call GeneralUtility::_GETset($language, 'L') at the beginning of your action.
Next you need to initialize TypoScriptFrontendController object and set sys_language_mode to 'strict' (if needed), becasue it is used in Typo3DbBackend->doLanguageAndWorkspaceOverlay() method.
This is non-obviuos and hacky workaround.
I'd like Repositiries and PropertyMapper work same regardless from context it is called: FE, BE or CLI; and such settings, which affect the result of Repository and PropertyMapper mthods, as sys_language_mode should be shareable between the context or at least I need to be able to set them without need to initialize TypoScriptFrontendController.