vendor/knplabs/knp-components/src/Knp/Component/Pager/Event/Subscriber/Sortable/SortableSubscriber.php line 16

Open in your IDE?
  1. <?php
  2. namespace Knp\Component\Pager\Event\Subscriber\Sortable;
  3. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  4. use Knp\Component\Pager\Event\BeforeEvent;
  5. class SortableSubscriber implements EventSubscriberInterface
  6. {
  7.     /**
  8.      * Lazy-load state tracker
  9.      * @var bool
  10.      */
  11.     private $isLoaded false;
  12.     public function before(BeforeEvent $event)
  13.     {
  14.         // Do not lazy-load more than once
  15.         if ($this->isLoaded) {
  16.             return;
  17.         }
  18.         $disp $event->getEventDispatcher();
  19.         // hook all standard sortable subscribers
  20.         $disp->addSubscriber(new Doctrine\ORM\QuerySubscriber());
  21.         $disp->addSubscriber(new Doctrine\ODM\MongoDB\QuerySubscriber());
  22.         $disp->addSubscriber(new ElasticaQuerySubscriber());
  23.         $disp->addSubscriber(new PropelQuerySubscriber());
  24.         $disp->addSubscriber(new SolariumQuerySubscriber());
  25.         $disp->addSubscriber(new ArraySubscriber());
  26.         $this->isLoaded true;
  27.     }
  28.     public static function getSubscribedEvents()
  29.     {
  30.         return array(
  31.             'knp_pager.before' => array('before'1)
  32.         );
  33.     }
  34. }