security = $security; } /** * @Route("/show", name="chill_main_notification_show") */ public function showAction( NotificationRepository $notificationRepository, NotificationRenderer $notificationRenderer, PaginatorFactory $paginatorFactory) { $currentUser = $this->security->getUser(); $notificationsNbr = $notificationRepository->countAllForAttendee(($currentUser)); $paginator = $paginatorFactory->create($notificationsNbr); $notifications = $notificationRepository->findAllForAttendee( $currentUser, $limit=$paginator->getItemsPerPage(), $offset= $paginator->getCurrentPage()->getFirstItemNumber()); $templateData = array(); foreach ($notifications as $notification) { $data = [ 'template' => $notificationRenderer->getTemplate($notification), 'template_data' => $notificationRenderer->getTemplateData($notification), 'notification' => $notification ]; $templateData[] = $data; } return $this->render('@ChillMain/Notification/show.html.twig', [ 'datas' => $templateData, 'notifications' => $notifications, 'paginator' => $paginator, ]); } }