[BUGFIX] Set _localizedUid in OriginColumnName 18/54518/2
authorAlexander Opitz <opitz.alexander@googlemail.com>
Tue, 7 Jul 2015 12:28:10 +0000 (14:28 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Wed, 1 Nov 2017 12:31:17 +0000 (13:31 +0100)
While saving an object the _localizedUid will be saved into the DB
column which is defined in TranslationOriginalColumnName.

Resolves: #66535
Releases: master,8.7
Change-Id: Ib23b97f90e805bd1107a3aac5b199f010ab231b3
Reviewed-on: https://review.typo3.org/54518
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php
typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php

index c703602..64b051d 100644 (file)
@@ -762,7 +762,7 @@ 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) {
+        if (!empty($parentObject->_getProperty('_localizedUid'))) {
             $parentUid = $parentObject->_getProperty('_localizedUid');
         }
         $row = [
@@ -934,7 +934,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
         $row['uid'] = $object->getUid();
         if ($dataMap->getLanguageIdColumnName() !== null) {
             $row[$dataMap->getLanguageIdColumnName()] = (int)$object->_getProperty('_languageUid');
-            if ($object->_getProperty('_localizedUid') !== null) {
+            if (!empty($object->_getProperty('_localizedUid'))) {
                 $row['uid'] = $object->_getProperty('_localizedUid');
             }
         }
index 4adb5be..f7a285b 100644 (file)
@@ -233,7 +233,7 @@ class DataMapper implements \TYPO3\CMS\Core\SingletonInterface
         $dataMap = $this->getDataMap($className);
         $object->_setProperty('uid', (int)$row['uid']);
         $object->_setProperty('pid', (int)$row['pid']);
-        $object->_setProperty('_localizedUid', (int)$row['uid']);
+        $object->_setProperty('_localizedUid', (int)$row[$dataMap->getTranslationOriginColumnName()]);
         $object->_setProperty('_versionedUid', (int)$row['uid']);
         if ($dataMap->getLanguageIdColumnName() !== null) {
             $object->_setProperty('_languageUid', (int)$row[$dataMap->getLanguageIdColumnName()]);