security = $security; } public static function getSubscribedEvents() { return array( 'easy_admin.post_list' => array('setPaginatorCountStatus'), ); } public function setPaginatorCountStatus(GenericEvent $event) { $paginator = $event->getSubject(); $em = $event->getArgument('em'); $entity = $event->getArgument('entity'); $entityRepo = $em->getRepository($entity['class']); $entityObject = new $entity['class']; if ($entityObject instanceof FilterMerchantInterface) { $currentMerchant = $this->security->getUser()->getMerchant(); $paginator->nbResultsOnline = $entityRepo->count(array('status'=>1,'merchant'=>$currentMerchant)); $paginator->nbResultsOffline = $entityRepo->count(array('status'=>0,'merchant'=>$currentMerchant)); $paginator->nbResultsDeleted = $entityRepo->count(array('status'=>-1,'merchant'=>$currentMerchant)); }else{ $paginator->nbResultsOnline = $entityRepo->count(array('status'=>1)); $paginator->nbResultsOffline = $entityRepo->count(array('status'=>0)); $paginator->nbResultsDeleted = $entityRepo->count(array('status'=>-1)); } } public function setBlogPostSlug(GenericEvent $event) { $entity = $event->getSubject(); if (!($entity instanceof BlogPost)) { return; } $slug = $this->slugger->slugify($entity->getTitle()); $entity->setSlug($slug); $event['entity'] = $entity; } }