[+TASK] Extbase (Persistence): Fixed a bug where Value Objects with only NULL values...
authorJochen Rau <j.rau@web.de>
Thu, 18 Feb 2010 09:25:16 +0000 (09:25 +0000)
committerJochen Rau <j.rau@web.de>
Thu, 18 Feb 2010 09:25:16 +0000 (09:25 +0000)
typo3/sysext/extbase/Classes/Persistence/Storage/Typo3DbBackend.php

index b9270fd..91fa1fb 100644 (file)
@@ -326,8 +326,12 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
                foreach ($properties as $propertyName => $propertyValue) {
                        // FIXME We couple the Backend to the Entity implementation (uid, isClone); changes there breaks this method
                        if ($dataMap->isPersistableProperty($propertyName) && ($propertyName !== 'uid')  && ($propertyName !== 'pid') && ($propertyName !== 'isClone')) {
-                               $fields[] = $dataMap->getColumnMap($propertyName)->getColumnName() . '=?';
-                               $parameters[] = $dataMap->convertPropertyValueToFieldValue($propertyValue);
+                               if ($propertyValue === NULL) {
+                                       $fields[] = $dataMap->getColumnMap($propertyName)->getColumnName() . ' IS NULL';
+                               } else {
+                                       $fields[] = $dataMap->getColumnMap($propertyName)->getColumnName() . '=?';
+                                       $parameters[] = $dataMap->convertPropertyValueToFieldValue($propertyValue);
+                               }
                        }
                }
                $sql = array();