[TYPO3-mvc] Re: Need resources: create translation of extbase domain object.

Philipp Wrann philippwrann at gmail.com
Tue Sep 1 12:40:21 CEST 2015


If someone is looking for the same:

clone does not work.
_localizedUid does not work

You have to:
create a new object
$objectManager->get(get_class($object));
Then set the language like above

Additionally you have to manually set the localization_parent property (i18n_parent/l10n_parent), you can add the property to your model and set it like:

/**
* @var \Vendor\Package\Domain\Model\Foo
* @lazy
*/
protected $localizationParent;

and use a setter to add the original record as parent.

To map the field (you could also name it $l10nParent i guess) you can use ext_typoscript_setup.txt and
config.tx_extbase.persistence.classes.Vendor\Package\Domain\Model\Foo.mapping.columns.l10n_parent.mapOnProperty = translationParent

To acutally apply the language overlay it is useful to add an ObjectStorage property to the aggregate object that holds all translated records. That way you can simply choose the correct translation.

Very important: You need to set the pid property to the same value as in the original record, otherwise overlay wont work.


More information about the TYPO3-project-typo3v4mvc mailing list