Implement Countable.
authorJan Schneider <jan@horde.org>
Fri, 28 Aug 2009 21:08:59 +0000 (23:08 +0200)
committerJan Schneider <jan@horde.org>
Fri, 28 Aug 2009 21:09:20 +0000 (23:09 +0200)
framework/Rdo/lib/Horde/Rdo/List.php

index 212878e..5f7ad9d 100644 (file)
@@ -12,7 +12,7 @@
  * @category Horde
  * @package  Horde_Rdo
  */
-class Horde_Rdo_List implements Iterator
+class Horde_Rdo_List implements Iterator, Countable
 {
     /**
      * Rdo Mapper
@@ -190,4 +190,17 @@ class Horde_Rdo_List implements Iterator
         return !$this->_eof;
     }
 
+    /**
+     * Returns the number of objects.
+     *
+     * @return integer
+     */
+    public function count()
+    {
+        if (is_null($this->_result)) {
+            $this->rewind();
+        }
+        return $this->_mapper->adapter->count();
+    }
+
 }