Permalink
Browse files

Start here

  • Loading branch information...
CesarScur committed Jun 3, 2011
0 parents commit 37fcb4991baed4996140ea4937e55f8b001e701f
Showing with 61 additions and 0 deletions.
  1. 0 README
  2. +61 −0 library/Cs/Paginator/Adapter/DoctrineQuery.php
0 README
No changes.
@@ -0,0 +1,61 @@
+<?php
+
+/**
+ * Description of DoctrineQuery
+ *
+ * @author Sugar
+ */
+class Cs_Paginator_Adapter_DoctrineQuery
+ implements Zend_Paginator_Adapter_Interface
+{
+
+ /**
+ *
+ * @var Doctrine_Query $_query
+ */
+ protected $_query;
+
+ /**
+ * @var Doctrine_Pager $_pager
+ */
+ protected $_pager;
+
+
+ public function __construct(Doctrine_Query $query) {
+ $this->setQuery($query);
+
+ }
+
+ public function getItems($offset, $itemCountPerPage) {
+ $pager = new Doctrine_Pager($this->getQuery(), $offset, $itemCountPerPage);
+ return $pager->execute();
+ }
+
+ public function count() {
+ return $this->getQuery()->count();
+ }
+
+
+ public function getQuery() {
+ return $this->_query;
+ }
+
+
+ public function setQuery($query) {
+ $this->_query = $query;
+ }
+
+
+ public function getPager() {
+ return $this->_pager;
+ }
+
+ public function setPager($pager) {
+ $this->_pager = $pager;
+ }
+
+
+
+
+}
+

0 comments on commit 37fcb49

Please sign in to comment.