How to use KNPPaginatorBundle to paginate results using Doctrine Repository?
问题 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-