[BUGFIX] Introduction package fails in DataMapProcessor 57/52357/3
authorOliver Hader <oliver@typo3.org>
Tue, 4 Apr 2017 09:19:56 +0000 (11:19 +0200)
committerBenni Mack <benni@typo3.org>
Tue, 4 Apr 2017 09:35:30 +0000 (11:35 +0200)
Change-Id: Icf785d1c79d739fff70aeed8e7745cfedc3993ac
Resolves: #80676
Releases: master
Reviewed-on: https://review.typo3.org/52357
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Thomas Hohn <thomas@hohn.dk>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: TYPO3com <no-reply@typo3.com>
Tested-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/core/Classes/DataHandling/Localization/DataMapItem.php

index 91f9305..e8cfda5 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Core\DataHandling\Localization;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
 
@@ -346,7 +347,7 @@ class DataMapItem
      */
     public function setParent($parent)
     {
-        $this->parent = $parent;
+        $this->parent = $this->extractId($parent);
     }
 
     /**
@@ -362,7 +363,7 @@ class DataMapItem
      */
     public function setSource($source)
     {
-        $this->source = $source;
+        $this->source = $this->extractId($source);
     }
 
     /**
@@ -423,6 +424,26 @@ class DataMapItem
     }
 
     /**
+     * Extracts real id from provided id-value, which can either be a real
+     * integer value, a 'NEW...' id, or a combined identifier 'tt_content_13'.
+     *
+     * @param int|string $idValue
+     * @return int|string
+     */
+    protected function extractId($idValue)
+    {
+        if (MathUtility::canBeInterpretedAsInteger($idValue)) {
+            return $idValue;
+        } elseif (strpos($idValue, 'NEW') === 0) {
+            return $idValue;
+        } else {
+            // @todo Handle if $tableName does not match $this->tableName
+            list($tableName, $id) = BackendUtility::splitTable_Uid($idValue);
+            return $id;
+        }
+    }
+
+    /**
      * @return null|State
      */
     protected function buildState()