From b53790eace9169196ecf2a998350fe4cabe02777 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 28 Aug 2012 17:27:51 +0200 Subject: [PATCH] Fluent API for PaginatedList --- core/PaginatedList.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/PaginatedList.php b/core/PaginatedList.php index 0401063ef..6aaa8c7c6 100644 --- a/core/PaginatedList.php +++ b/core/PaginatedList.php @@ -52,6 +52,7 @@ class PaginatedList extends SS_ListDecorator { */ public function setPaginationGetVar($var) { $this->getVar = $var; + return $this; } /** @@ -70,6 +71,7 @@ class PaginatedList extends SS_ListDecorator { */ public function setPageLength($length) { $this->pageLength = $length; + return $this; } /** @@ -79,6 +81,7 @@ class PaginatedList extends SS_ListDecorator { */ public function setCurrentPage($page) { $this->pageStart = ($page - 1) * $this->pageLength; + return $this; } /** @@ -106,6 +109,7 @@ class PaginatedList extends SS_ListDecorator { */ public function setPageStart($start) { $this->pageStart = $start; + return $this; } /** @@ -129,6 +133,7 @@ class PaginatedList extends SS_ListDecorator { */ public function setTotalItems($items) { $this->totalItems = $items; + return $this; } /** @@ -143,6 +148,7 @@ class PaginatedList extends SS_ListDecorator { $this->setPageStart($limit['start']); $this->setTotalItems($query->unlimitedRowCount()); } + return $this; } /** @@ -165,6 +171,7 @@ class PaginatedList extends SS_ListDecorator { */ public function setLimitItems($limit) { $this->limitItems = (bool) $limit; + return $this; } /** @@ -432,6 +439,7 @@ class PaginatedList extends SS_ListDecorator { $this->setPageStart($pageStart); $this->setPageLength($pageLength); $this->setTotalSize($totalSize); + return $this; } }