[BUGFIX] Set correct foreign parentkey when writing inline relations 96/46996/3
authorPhilipp Wrann <wrann@pixelpoint.at>
Wed, 2 Mar 2016 12:46:39 +0000 (13:46 +0100)
committerFrank Naegler <frank.naegler@typo3.org>
Tue, 8 May 2018 13:25:48 +0000 (15:25 +0200)
When attaching or updating 1:N relations via extbase (INLINE) the
parents uid property was taken as parentKey for the relation entity.

This behaviour is inconsistant to the FormEngine resulting in
wrong weird rendering resconstitution of 1:N relations.

This patch sets the _localizedUid of the parent object (if set)
as parentKey to the parentKeyFieldColumn.

Resolves: #73726
Releases: master
Change-Id: I47fa0f05eb46353f5b893fff07f0123325a0d515
Reviewed-on: https://review.typo3.org/46996
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Timo Pfeffer <pfeffer.timo+typo3@gmail.com>
Reviewed-by: Tobi Kretschmann <tobi@tobishome.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>

index e3a9b0f..af2dd46 100644 (file)
@@ -584,7 +584,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
         $row = [];
         $parentKeyFieldName = $parentColumnMap->getParentKeyFieldName();
         if ($parentKeyFieldName !== null) {
-            $row[$parentKeyFieldName] = $parentObject->getUid();
+            $row[$parentKeyFieldName] = $parentObject->_getProperty('_localizedUid') ?: $parentObject->getUid();
             $parentTableFieldName = $parentColumnMap->getParentTableFieldName();
             if ($parentTableFieldName !== null) {
                 $row[$parentTableFieldName] = $parentDataMap->getTableName();