BugFixes in PlSet and PlFilter
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Thu, 21 Jan 2010 00:54:47 +0000 (01:54 +0100)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Thu, 21 Jan 2010 00:54:47 +0000 (01:54 +0100)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
classes/plfilter.php [moved from include/plfilter.inc.php with 97% similarity]
classes/plset.php

similarity index 97%
rename from include/plfilter.inc.php
rename to classes/plfilter.php
index 2548574..ed0e039 100644 (file)
@@ -327,19 +327,21 @@ abstract class PlFilter
      *
      * "$ME" => "joined table alias" is always added to these.
      */
-    private $joinMetas = array();
+    protected $joinMetas = array();
+
+    protected $joinMethods = array();
 
     /** Build the 'join' part of the query
      * This function will call all methods declared in self::$joinMethods
      * to get an array of PlSqlJoin objects to merge
      */
-    private function buildJoins()
+    protected function buildJoins()
     {
         $joins = array();
-        foreach ($this->$joinMethods as $method) {
+        foreach ($this->joinMethods as $method) {
             $joins = array_merge($joins, $this->$method());
         }
-        return PlSqlJoin::formatJoins($joins, $this->$joinMetas);
+        return PlSqlJoin::formatJoins($joins, $this->joinMetas);
     }
 
 }
index 8ef6ba8..93afc3f 100644 (file)
@@ -19,6 +19,7 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
+
 /** UserSet is a light-weight Model/View tool for displaying a set of items
  */
 abstract class PlSet
@@ -83,10 +84,13 @@ abstract class PlSet
      */
     abstract protected function buildFilter(PlFilterCondition &$cond, $orders);
 
-    public function &get(PlFilterLimit $limit = null)
+    public function &get(PlLimit $limit = null)
     {
         $pf = $this->buildFilter($this->conds, $this->orders);
 
+        if (is_null($limit)) {
+            $limit = new PlLimit(20, 0);
+        }
         $it          = $pf->get($limit);
         $this->count = $pf->getTotalCount();
         return $it;