[BUGFIX] Save parents localized uid as child reference 47/43147/3
authorNicole Cordes <typo3@cordes.co>
Wed, 9 Sep 2015 09:29:57 +0000 (11:29 +0200)
committerMathias Schreiber <mathias.schreiber@wmdb.de>
Tue, 24 Nov 2015 09:53:56 +0000 (10:53 +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/43147
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Markus Sommer <markussom@posteo.de>
Tested-by: Markus Sommer <markussom@posteo.de>
Reviewed-by: Josef Glatz <josef.glatz@typo3.org>
Tested-by: Josef Glatz <josef.glatz@typo3.org>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Reviewed-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php

index f75e615..9b16900 100644 (file)
@@ -776,8 +776,12 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
     {
         $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
         );