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 ($person === NULL) { throw $this->createNotFoundException(); } $this->denyAccessUnlessGranted(PersonVoter::SEE, $person); $nbItems = $this->timelineBuilder->countItems('person', [ 'person' => $person ] ); $paginator = $this->paginatorFactory->create($nbItems); $event = new PrivacyEvent($person, array('action' => 'timeline')); $this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); return $this->render('ChillPersonBundle:Timeline:index.html.twig', array ( 'timeline' => $this->timelineBuilder->getTimelineHTML( 'person', array('person' => $person), $paginator->getCurrentPage()->getFirstItemNumber(), $paginator->getItemsPerPage() ), 'person' => $person, 'nb_items' => $nbItems, 'paginator' => $paginator ) ); } }