Pagination - Symfoy
- by user390426
Hi
I have the following code:
public function executeList()
{
$c = new Criteria();
$c->setLimit(5);
$this->latest = ItemPeer::doSelectLatest($c);
}
Now I'd like to be able to use pagination with this, using sfPropelPager.
How could I use that with the code above, making sure It paginates results from the peer method?
Thanks
EDIT:
Got it working:
$pager = new sfPropelPager('Item', 10);
$pager->setPage($request->getParameter('page', 1));
$pager->setPeerMethod('doSelectLatest');
$pager->init();
$this->pager = $pager;
Thanks!