简体   繁体   中英

Pagerfanta not working by use queryBuilder in Symfony PHP

I have queryBuilder and I want to use Pagerfanta

So this is my code

$adapter = new DoctrineORMAdapter($queryBuilder);
$pager = new Pagerfanta($adapter);

$pager->setCurrentPage($options['page']);
$pager->setMaxPerPage($options['limit']);

return $pager;

but on frontend when I click on next or choose page it will always show on first page. 在此输入图像描述

I don't know how Pagerfanta working please help.

I've already fixed this.

Because I Pagerfanta don't know what is this page it's still look at default page "$options['page'] == 1"

So I just send parameters page from url to

page = app.request.get('page') 

"$options['page']"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM