[~BUGFIX] Extbase (Persistence): If a lazy loaded 1:n relation is empty, the property...
authorJochen Rau <j.rau@web.de>
Tue, 2 Mar 2010 16:20:06 +0000 (16:20 +0000)
committerJochen Rau <j.rau@web.de>
Tue, 2 Mar 2010 16:20:06 +0000 (16:20 +0000)
typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapper.php

index 7dfcf3f..3272046 100644 (file)
@@ -249,7 +249,11 @@ class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton {
                        if (($propertyMetaData['type'] === 'Tx_Extbase_Persistence_ObjectStorage') || ($columnMap->getLoadingStrategy() === Tx_Extbase_Persistence_Mapper_ColumnMap::STRATEGY_LAZY_STORAGE)) {
                                $result = t3lib_div::makeInstance('Tx_Extbase_Persistence_LazyObjectStorage', $parentObject, $propertyName, $fieldValue);                               
                        } else {
-                               $result = t3lib_div::makeInstance('Tx_Extbase_Persistence_LazyLoadingProxy', $parentObject, $propertyName, $fieldValue);
+                               if (empty($fieldValue)) {
+                                       $result = NULL;
+                               } else {
+                                       $result = t3lib_div::makeInstance('Tx_Extbase_Persistence_LazyLoadingProxy', $parentObject, $propertyName, $fieldValue);
+                               }
                        }
                } else {
                        $result = $this->fetchRelatedEager($parentObject, $propertyName, $fieldValue, $performLanguageOverlay);