diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php index e7cba2f..cd81e02 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php @@ -406,6 +406,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface if ($propertyValue->_isNew()) { $this->insertObject($propertyValue, $object, $propertyName); } + // Check explicitly for NULL, as getPlainValue would convert this to 'NULL' $row[$columnMap->getColumnName()] = $propertyValue !== null ? $this->dataMapper->getPlainValue($propertyValue) @@ -414,6 +415,14 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface $queue[] = $propertyValue; } elseif ($object->_isNew() || $object->_isDirty($propertyName)) { $row[$columnMap->getColumnName()] = $this->dataMapper->getPlainValue($propertyValue, $columnMap); + + $className = get_class($object); + $propertyMetaData = $this->reflectionService->getClassSchema($className)->getProperty($propertyName); + $cleanProperty = $object->_getCleanProperty($propertyName); + + if ($propertyValue === null && $cleanProperty instanceof \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface && $propertyMetaData['cascade'] === 'remove') { + $this->removeEntity($cleanProperty); + } } } if (!empty($row)) {