From 9a122520bc4c6547f6506a0cd35e49737809b1c4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Barrois?= Date: Thu, 21 Jan 2010 01:54:47 +0100 Subject: [PATCH] BugFixes in PlSet and PlFilter MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Barrois --- include/plfilter.inc.php => classes/plfilter.php | 10 ++++++---- classes/plset.php | 6 +++++- 2 files changed, 11 insertions(+), 5 deletions(-) rename include/plfilter.inc.php => classes/plfilter.php (97%) diff --git a/include/plfilter.inc.php b/classes/plfilter.php similarity index 97% rename from include/plfilter.inc.php rename to classes/plfilter.php index 2548574..ed0e039 100644 --- a/include/plfilter.inc.php +++ b/classes/plfilter.php @@ -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); } } diff --git a/classes/plset.php b/classes/plset.php index 8ef6ba8..93afc3f 100644 --- a/classes/plset.php +++ b/classes/plset.php @@ -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; -- 2.1.4