knppaginatorbundle

How to use KNPPaginatorBundle to paginate results using Doctrine Repository?

耗尽温柔 提交于 2019-12-31 22:09:11
问题 I'm working on a Symfony2 project and I decided to use KNPPaginatorBundle to build an easy pagination system. So I created a Product entity and I want to add the paginator to indexAction action (generated by CRUD command). // Retrieving products. $em = $this->getDoctrine()->getManager(); //$entities = $em->getRepository('LiveDataShopBundle:Product')->findAll(); $dql = "SELECT a FROM LiveDataShopBundle:Product a"; $entities = $em->createQuery($dql); // Creating pagnination $paginator = $this-

How to use KNPPaginatorBundle to paginate results using Doctrine Repository?

こ雲淡風輕ζ 提交于 2019-12-31 22:09:09
问题 I'm working on a Symfony2 project and I decided to use KNPPaginatorBundle to build an easy pagination system. So I created a Product entity and I want to add the paginator to indexAction action (generated by CRUD command). // Retrieving products. $em = $this->getDoctrine()->getManager(); //$entities = $em->getRepository('LiveDataShopBundle:Product')->findAll(); $dql = "SELECT a FROM LiveDataShopBundle:Product a"; $entities = $em->createQuery($dql); // Creating pagnination $paginator = $this-