This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace General\GeneralBundle\EventListener; | |
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | |
use Knp\Component\Pager\Event\ItemsEvent; | |
use Doctrine\ORM\Query; | |
use Doctrine\ORM\QueryBuilder; | |
class KnpPaginatorQuerySubscriber implements EventSubscriberInterface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function listAction() | |
{ | |
$em = $this->getDoctrine()->getManager(); | |
$repository = $em->getRepository('ExampleBundle:Entity'); | |
$qb = $historyRepository->createQueryBuilder('EntityAlias'); | |
$knpPaginator = $this->get('knp_paginator'); | |
$paginationAAA = $knpPaginator->paginate( | |
$qb, |
NewerOlder