Pagination using Doctrine and ZF2

后端 未结 1 1655
失恋的感觉
失恋的感觉 2021-02-03 13:55

i am trying to implement Pagination Using ZF2 and Doctrine.

What i am trying to do here is to fetch data from An associated table lets say \'xyz\'.

Where as my c

相关标签:
1条回答
  • 2021-02-03 14:17

    You are using the wrong paginator there. Instead, you can use the one by DoctrineORMModule ( see DoctrineORMModule\Paginator\Adapter\DoctrinePaginator).

    It may not be very obvious, but the logic is similar to what you already wrote:

    use DoctrineORMModule\Paginator\Adapter\DoctrinePaginator as PaginatorAdapter;
    use Doctrine\ORM\Tools\Pagination\Paginator as ORMPaginator;
    use Zend\Paginator\Paginator as ZendPaginator;
    
    $query = $categoryModel->allSubcategories($category_id, $column, $order);
    
    $paginator = new ZendPaginator(new PaginatorAdapter(new ORMPaginator($query)));
    
    0 讨论(0)
提交回复
热议问题