[+BUGFIX] Extbase (Persistence): The function in_array is now used to determine which...
authorJochen Rau <j.rau@web.de>
Thu, 17 Sep 2009 10:25:16 +0000 (10:25 +0000)
committerJochen Rau <j.rau@web.de>
Thu, 17 Sep 2009 10:25:16 +0000 (10:25 +0000)
[~BUGFIX] Extbase (Persistence): Reverted the method to count elements of a comma separated list relation because it ignores hidden elements. Related to #3596, #4669, #4635.
[~TASK] Extbase: Changed status from alpha to beta. Extbase is now attached to category "misc".

typo3/sysext/extbase/Classes/Persistence/Backend.php
typo3/sysext/extbase/Classes/Persistence/LazyObjectStorage.php
typo3/sysext/extbase/Classes/Persistence/ObjectStorage.php
typo3/sysext/extbase/ext_emconf.php

index ceb66fb..e3a5ccd 100644 (file)
@@ -381,7 +381,7 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
                                                $queuedObjects[$propertyName][] = $relatedObject;
                                        }
                                        foreach ($this->getDeletedChildObjects($object, $propertyName) as $deletedObject) {
-                                               $this->deleteObject($deletedObject, $object, $propertyName, TRUE, FALSE);
+                                               $this->deleteObject($deletedObject, $object, $propertyName);
                                        }
                                        $row[$columnName] = count($propertyValue); // Will be overwritten if the related objects are referenced by a comma separated list
                                }
@@ -414,9 +414,12 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
                        if ($propertyValue instanceof Tx_Extbase_Persistence_ObjectStorage) {
                                $propertyValue = $propertyValue->toArray();
                        }
-                       $deletedObjects = array_diff($cleanPropertyValue, $propertyValue);
+                       foreach ($cleanPropertyValue as $item) {
+                               if (!in_array($item, $propertyValue)) {
+                                       $deletedObjects[] = $item;
+                               }
+                       }
                }
-
                return $deletedObjects;
        }
 
index b424564..705aa85 100644 (file)
@@ -113,14 +113,17 @@ class Tx_Extbase_Persistence_LazyObjectStorage extends Tx_Extbase_Persistence_Ob
        public function count() {
                $numberOfElements = NULL;
                if ($this->columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
-                       if (isset($parentKeyFieldName)) {
-                               $numberOfElements = $this->fieldValue;
-                       } else {
-                               if (empty($this->fieldValue)) {
-                                       $numberOfElements = 0;
-                               }
-                               $numberOfElements = count(explode(',', $this->fieldValue));
-                       }
+                       $this->initializeStorage();
+                       $numberOfElements = count($this->storage);
+                       // FIXME Count on comma separated lists does not respect hidden objects
+//                     if (isset($parentKeyFieldName)) {
+//                             $numberOfElements = $this->fieldValue;
+//                     } else {
+//                             if (empty($this->fieldValue)) {
+//                                     $numberOfElements = 0;
+//                             }
+//                             $numberOfElements = count(explode(',', $this->fieldValue));
+//                     }
                } elseif ($this->columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
                        $numberOfElements = $this->fieldValue;                  
                } else {
index 94a2119..5de0ace 100644 (file)
@@ -247,4 +247,4 @@ class Tx_Extbase_Persistence_ObjectStorage implements Iterator, Countable, Array
 
 }
 
-?>
+?>
\ No newline at end of file
index 22a24a6..aabe815 100644 (file)
@@ -13,7 +13,7 @@
 $EM_CONF[$_EXTKEY] = array(
        'title' => 'A Framework for Extensions',
        'description' => 'A framework to build extensions in the style of FLOW3 by now.',
-       'category' => 'fe',
+       'category' => 'misc',
        'author' => '',
        'author_email' => '',
        'shy' => '',
@@ -21,7 +21,7 @@ $EM_CONF[$_EXTKEY] = array(
        'conflicts' => '',
        'priority' => 'top',
        'module' => '',
-       'state' => 'alpha',
+       'state' => 'beta',
        'internal' => '',
        'uploadfolder' => 0,
        'createDirs' => '',