[+FEATURE] Extbase (Persistence): Implemented removeAll() to the Persistence Reposito...
authorJochen Rau <j.rau@web.de>
Wed, 27 Jan 2010 14:33:56 +0000 (14:33 +0000)
committerJochen Rau <j.rau@web.de>
Wed, 27 Jan 2010 14:33:56 +0000 (14:33 +0000)
typo3/sysext/extbase/Classes/Persistence/Repository.php

index 4283ac8..eb3e8e9 100644 (file)
@@ -208,6 +208,20 @@ class Tx_Extbase_Persistence_Repository implements Tx_Extbase_Persistence_Reposi
                $result = $this->createQuery()->execute();
                return $result;
        }
+       
+       /**
+        * Removes all objects of this repository as if remove() was called for
+        * all of them.
+        *
+        * @return void
+        * @api
+        */
+       public function removeAll() {
+               $this->addedObjects = new Tx_Extbase_Persistence_ObjectStorage();
+               foreach ($this->findAll() as $object) {
+                       $this->remove($object);
+               }
+       }
 
        /**
         * Finds an object matching the given identifier.