[BUGFIX] Extbase: Use correct value type in detachObjectFromParentObject() 55/42655/2
authorMorton Jonuschat <m.jonuschat@mojocode.de>
Sat, 15 Aug 2015 20:11:10 +0000 (22:11 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sat, 15 Aug 2015 23:41:18 +0000 (01:41 +0200)
When detaching an object from it's parent in a 1:n relation the field
holding the parent uid may not be set to an empty string as this field
actually holds an integer value. This leads to SQL errors when used with
MySQL in strict mode.

Resolves: #69090
Releases: master
Change-Id: I8ed003456378b0ea1f2697a267874745126fae91
Reviewed-on: http://review.typo3.org/42655
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php

index 3e03cbc..b3b4956 100644 (file)
@@ -600,7 +600,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
                        $row = array();
                        $parentKeyFieldName = $parentColumnMap->getParentKeyFieldName();
                        if ($parentKeyFieldName !== NULL) {
-                               $row[$parentKeyFieldName] = '';
+                               $row[$parentKeyFieldName] = 0;
                                $parentTableFieldName = $parentColumnMap->getParentTableFieldName();
                                if ($parentTableFieldName !== NULL) {
                                        $row[$parentTableFieldName] = '';