[+BUGFIX] Extbase (Persistence): Added check for array before calling current() in...
authorJochen Rau <j.rau@web.de>
Tue, 25 May 2010 13:23:47 +0000 (13:23 +0000)
committerJochen Rau <j.rau@web.de>
Tue, 25 May 2010 13:23:47 +0000 (13:23 +0000)
typo3/sysext/extbase/Classes/Persistence/Mapper/DataMapper.php

index ef28906..001f948 100644 (file)
@@ -424,6 +424,7 @@ class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton {
         *
         * @param mixed $result The result could be an object or an ObjectStorage 
         * @param array $propertyMetaData The property meta data
+        * @param array $result The result 
         * @return void
         */
        public function mapResultToPropertyValue(Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName, $result) {
@@ -450,7 +451,11 @@ class Tx_Extbase_Persistence_Mapper_DataMapper implements t3lib_Singleton {
                                        $propertyValue = $objects;
                                }
                        } elseif (strpos($propertyMetaData['type'], '_') !== FALSE) {
-                               $propertyValue = current($result);
+                               if (is_array($result)) {
+                                       $propertyValue = current($result);
+                               } else {
+                                       $propertyValue = $result;
+                               }
                        }
                }
                return $propertyValue;