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']; $criteria = array(); if ($entityObject instanceof FilterMerchantInterface) { $currentMerchant = $this->security->getUser()->getMerchant(); $criteria['merchant'] = $currentMerchant; } if($entityObject instanceof StatusInterface) { for ($status = -1; $status <= 1; $status++) { $criteria['status'] = $status; if ($status == -1) { $paginator->nbResultsDeleted = $entityRepo->count($criteria); } elseif ($status == 0) { $paginator->nbResultsOffline = $entityRepo->count($criteria); } else if ($status == 1) { $paginator->nbResultsOnline = $entityRepo->count($criteria); } } } } 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; } }