[BUGFIX] Save parents localized uid as child reference 26/44926/2
authorNicole Cordes <typo3@cordes.co>
Wed, 9 Sep 2015 09:29:57 +0000 (11:29 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Tue, 24 Nov 2015 13:32:36 +0000 (14:32 +0100)
This patch resolves problems with updating translated records which
have a relation to a parent object. The backend expects the localized
uid as parent id but extbase currently saves the original uid. This
leads to wrong relation information within the child record.

Resolves: #69630
Releases: master, 6.2
Change-Id: Ib0af8b5fa13c03e15c4db5cb0ac1a81c8ee568eb
Reviewed-on: https://review.typo3.org/44926
Reviewed-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php

index a4e6b42..3336ccc 100644 (file)
@@ -691,8 +691,12 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
        protected function insertRelationInRelationtable(\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $object, \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $parentObject, $propertyName, $sortingPosition = NULL) {
                $dataMap = $this->dataMapper->getDataMap(get_class($parentObject));
                $columnMap = $dataMap->getColumnMap($propertyName);
+               $parentUid = $parentObject->getUid();
+               if ($parentObject->_getProperty('_localizedUid') !== NULL) {
+                       $parentUid = $parentObject->_getProperty('_localizedUid');
+               }
                $row = array(
-                       $columnMap->getParentKeyFieldName() => (int)$parentObject->getUid(),
+                       $columnMap->getParentKeyFieldName() => (int)$parentUid,
                        $columnMap->getChildKeyFieldName() => (int)$object->getUid(),
                        $columnMap->getChildSortByFieldName() => !is_null($sortingPosition) ? (int)$sortingPosition : 0
                );