eventDispatcher = $eventDispatcher; $this->timelineBuilder = $timelineBuilder; $this->paginatorFactory = $paginatorFactory; } public function personAction(Request $request, $person_id) { $person = $this->getDoctrine() ->getRepository(Person::class) ->find($person_id); if (null === $person) { throw $this->createNotFoundException(); } $this->denyAccessUnlessGranted(PersonVoter::SEE, $person); $nbItems = $this->timelineBuilder->countItems( 'person', ['person' => $person] ); $paginator = $this->paginatorFactory->create($nbItems); $event = new PrivacyEvent($person, ['action' => 'timeline']); $this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); return $this->render( 'ChillPersonBundle:Timeline:index.html.twig', [ 'timeline' => $this->timelineBuilder->getTimelineHTML( 'person', ['person' => $person], $paginator->getCurrentPage()->getFirstItemNumber(), $paginator->getItemsPerPage() ), 'person' => $person, 'nb_items' => $nbItems, 'paginator' => $paginator, ] ); } }