[TYPO3-mvc] data from default lang for object in actual lang?
Bernd Wilke
t3ng at pi-phi.tk
Thu Sep 29 10:32:21 CEST 2011
I'm just entering extbase space.
I got a project and have to change the behaviour - and get lost.
description of the project:
a lot of records with a variant field which includes a flexform, where
data is stored as xml.
handling to these fields works as expected.
now i should change the behaviour on translation:
translated records should not include the whole flexform but only some
fields, which really contain language-dependent information. most fields
stay the same. especially the high-resolution images. at the moment all
fields are copied on translation including all the big images. As there
are 6 languages this results in 6 identical copies of each image and a
lot of wasted space on the server.
as these values are stored inside the XML there is no fallback on (XML-)
field level (the table-field is the whole XML).
I introduced a further variant which only includes the translated XML-
fields, but now I have to merge the XML from the default-language-record
with the XML from the actual translated record.
two problems:
1 how can I access the default-record?
public function findProductDefaultLang( $product ) {
$query->getQuerySettings()->setRespectSysLanguage(false);
$query->getQuerySettings()->setRespectStoragePage(true);
$constraints = $query->equals('uid', $product->_getProperty('uid'));
return $query->matching($constraints)->execute();
}
this should get the record/object with default-language, but the result
is still translated.
2 (a little bit off-topic) how can I merge the two XMLs?
on one level I have the XML-strings, after parsing I have two recursive
arrays of simpleXMLObjects, where handling seems weird.
bernd
--
http://www.pi-phi.de/t3v4/cheatsheet.html
More information about the TYPO3-project-typo3v4mvc
mailing list