[Solar-svn] Revision 3060

pmjones at solarphp.com pmjones at solarphp.com
Sat Mar 29 18:52:01 CDT 2008


Solar_Sql_Model_Collection: [ADD] Add pager-info keys for 'begin' and 'end', and comments.


Modified: trunk/Solar/Sql/Model/Collection.php
===================================================================
--- trunk/Solar/Sql/Model/Collection.php	2008-03-29 23:51:15 UTC (rev 3059)
+++ trunk/Solar/Sql/Model/Collection.php	2008-03-29 23:52:00 UTC (rev 3060)
@@ -37,7 +37,45 @@
      */
     protected $_related = array();
     
-    protected $_pager_info;
+    /**
+     * 
+     * The pager information for this collection.
+     * 
+     * Keys are ...
+     * 
+     * `count`
+     * : (int) The total number of rows in the database.
+     * 
+     * `pages`
+     * : (int) The total number of pages in the database (count / paging).
+     * 
+     * `paging`
+     * : (int) The number of rows per page for the collection.
+     * 
+     * `page`
+     * : (int) The page-number of the collection.
+     * 
+     * `begin`
+     * : (int) The row-number at which the collection begins.
+     * 
+     * `end`
+     * : (int) The row-number at which the collection ends.
+     * 
+     * @param array
+     * 
+     * @see setPagerInfo()
+     * 
+     * @see getPagerInfo()
+     * 
+     */
+    protected $_pager_info = array(
+        'count'  => null,
+        'pages'  => null,
+        'paging' => null,
+        'page'   => null,
+        'begin'  => null,
+        'end'    => null,
+    );
     
     /**
      * 
@@ -110,6 +148,20 @@
         return $this->_model;
     }
     
+    /**
+     * 
+     * Injects pager information for the collection.
+     * 
+     * Generally used only by the model fetchAll() and fetchAssoc() methods.
+     * 
+     * @param array $info An array of information with keys for `count`,
+     * `pages`, `paging`, `page`, `begin`, and `end`.
+     * 
+     * @return void
+     * 
+     * @see $_pager_info
+     * 
+     */
     public function setPagerInfo($info)
     {
         $base = array(
@@ -117,11 +169,23 @@
             'pages'  => null,
             'paging' => null,
             'page'   => null,
+            'begin'  => null,
+            'end'    => null,
         );
         
         $this->_pager_info = array_merge($base, $info);
     }
     
+    /**
+     * 
+     * Gets the injected pager information for the collection.
+     * 
+     * @return array An array of information with keys for `count`,
+     * `pages`, `paging`, `page`, `begin`, and `end`.
+     * 
+     * @see $_pager_info
+     * 
+     */
     public function getPagerInfo()
     {
         return $this->_pager_info;




More information about the Solar-svn mailing list