get TYPO3 Extbase Repository items in other languages -


how can items extbase respository in different language?

what tested:

  • findbyuid($childuid)
  • $query->getquerysettings()->setrespectsyslanguage(false);
  • $query->getquerysettings()->setsyslanguageuid(3);

but result parent (lang) object.

i tried "matching" , "statement" result query uses active language or searches sys_language_id in (0,-1) = (default/all).

it seems bug in extbase not removed until typo3 7.1: https://forge.typo3.org/issues/45873

for me solves problem: https://forge.typo3.org/issues/45873#note-27

after modification possible translated objects repository (e.g byuid or in own query)

(copied linked page, 07.04.2015)


1.hack extbase in extension (in ext_localconf.php) register "customqueryresult" class:

// code below no public api! /** @var $extbaseobjectcontainer \typo3\cms\extbase\object\container\container */ $extbaseobjectcontainer = \typo3\cms\core\utility\generalutility::makeinstance('typo3\\cms\\extbase\\object\\container\\container');  $extbaseobjectcontainer->registerimplementation('typo3\cms\extbase\persistence\queryresultinterface', 'yourvendor\yourext\persistence\storage\customqueryresult'); unset($extbaseobjectcontainer); 

2.implement simple customqueryresult class:

class customqueryresult extends \typo3\cms\extbase\persistence\generic\queryresult {      /**      * @var \yourvendor\yourext\persistence\storage\customdatamapper      * @inject      */     protected $datamapper; } 

3.implement customdatamapper class , overwrite method "mapsinglerow":

class customdatamapper extends \typo3\cms\extbase\persistence\generic\mapper\datamapper {      /**      * maps single row on object of given class      *      * @param string $classname name of target class      * @param array $row single array field_name => value pairs      * @return object object of given class      */     protected function mapsinglerow($classname, array $row) {         $uid = isset($row['_localized_uid']) ? $row['_localized_uid'] : $row['uid'];         if ($this->identitymap->hasidentifier($uid, $classname)) {             $object = $this->identitymap->getobjectbyidentifier($uid, $classname);         } else {             $object = $this->createemptyobject($classname);             $this->identitymap->registerobject($object, $uid);             $this->thawproperties($object, $row);             $object->_memorizecleanstate();             $this->persistencesession->registerreconstitutedentity($object);         }         return $object;     } } 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -