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