public function testPaginate() { $c = new ModelCriteria('bookstore', 'Book', 'b'); $c->join('b.Author a'); $c->where('a.FirstName = ?', 'Neal'); $books = $c->paginate(1, 5); $this->assertTrue($books instanceof PropelModelPager, 'paginate() returns a PropelModelPager'); $this->assertEquals(1, count($books), 'paginate() returns a countable pager with the correct count'); foreach ($books as $book) { $this->assertEquals('Neal', $book->getAuthor()->getFirstName(), 'paginate() returns an iterable pager'); } }
/** * Paginate collection. * * @param int $page * @param int $numPerPage * @return mixed */ public function paginate($page, $numPerPage) { return $this->query->paginate($page, $numPerPage); }
/** * @inheritDoc */ public function paginate() { $this->query->paginate($this->page, $this->limit); return $this->query; }
protected function find(\ModelCriteria $query, $params) { $page = isset($params['p']) ? $params['p'] : 1; $maxPerPage = isset($params['mpp']) ? $params['mpp'] : $this->options['maxPerPage']; $pager = $query->paginate($page, $maxPerPage); return $pager; }