Pagination - Symfoy
Posted
by
user390426
on Stack Overflow
See other posts from Stack Overflow
or by user390426
Published on 2011-01-06T13:32:25Z
Indexed on
2011/01/07
13:54 UTC
Read the original article
Hit count: 159
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!
© Stack Overflow or respective owner