From 68e8530319faea18fbc61eee55fc00298582e8de Mon Sep 17 00:00:00 2001 From: Alexander Opitz <opitz.alexander@googlemail.com> Date: Tue, 7 Jul 2015 14:28:10 +0200 Subject: [PATCH] [BUGFIX] Set _localizedUid in OriginColumnName 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/54376 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com> Tested-by: Alexander Opitz <opitz.alexander@googlemail.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 | 4 ++-- .../extbase/Classes/Persistence/Generic/Mapper/DataMapper.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php index 63ec1c45dff2..c052a65ea379 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php @@ -763,7 +763,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 = [ @@ -935,7 +935,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'); } } diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php index 2e55f63235c6..e6af94735df9 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php @@ -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()]); -- GitLab