diff --git a/library/vendor/ipl/Data/SimpleQueryPaginationAdapter.php b/library/vendor/ipl/Data/SimpleQueryPaginationAdapter.php new file mode 100644 index 00000000..230877d5 --- /dev/null +++ b/library/vendor/ipl/Data/SimpleQueryPaginationAdapter.php @@ -0,0 +1,69 @@ +query = $query; + } + + public function count() + { + Benchmark::measure('Running count() for pagination'); + $count = $this->query->count(); + Benchmark::measure("Counted $count rows"); + + return $count; + } + + public function limit($count = null, $offset = null) + { + $this->query->limit($count, $offset); + } + + public function hasLimit() + { + return $this->getLimit() !== null; + } + + public function getLimit() + { + return $this->query->getLimit(); + } + + public function setLimit($limit) + { + $this->query->limit( + $limit, + $this->getOffset() + ); + } + + public function hasOffset() + { + return $this->getOffset() !== null; + } + + public function getOffset() + { + return $this->query->hasOffset(); + } + + public function setOffset($offset) + { + $this->query->limit( + $this->getLimit(), + $offset + ); + } +}