From 5f36a623790d581bc54b15bb484a095ec5dde402 Mon Sep 17 00:00:00 2001 From: Mat Date: Tue, 16 Oct 2018 12:36:19 +0200 Subject: [PATCH] privacyEvent, add event in accompanyingPeriod --- Controller/AccompanyingPeriodController.php | 25 +++++++++++++++++++++ Resources/config/services/controller.yml | 4 ++++ 2 files changed, 29 insertions(+) diff --git a/Controller/AccompanyingPeriodController.php b/Controller/AccompanyingPeriodController.php index b7d4241ab..c678fe817 100644 --- a/Controller/AccompanyingPeriodController.php +++ b/Controller/AccompanyingPeriodController.php @@ -22,20 +22,45 @@ namespace Chill\PersonBundle\Controller; +use Chill\PersonBundle\Privacy\PrivacyEvent; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Form\AccompanyingPeriodType; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Doctrine\Common\Collections\Criteria; use Chill\PersonBundle\Security\Authorization\PersonVoter; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; class AccompanyingPeriodController extends Controller { + /** + * @var EventDispatcherInterface + */ + protected $eventDispatcher; + + /** + * ReportController constructor. + * + * @param EventDispatcherInterface $eventDispatcher + */ + public function __construct(EventDispatcherInterface $eventDispatcher) + { + $this->eventDispatcher = $eventDispatcher; + } + + + public function listAction($person_id){ $person = $this->_getPerson($person_id); + + $event = new PrivacyEvent($person, null, array( + 'element_class' => AccompanyingPeriod::class, + 'action' => 'list' + )); + $this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); return $this->render('ChillPersonBundle:AccompanyingPeriod:list.html.twig', array('accompanying_periods' => $person->getAccompanyingPeriodsOrdered(), diff --git a/Resources/config/services/controller.yml b/Resources/config/services/controller.yml index 7ca377e62..8e2fb9fdf 100644 --- a/Resources/config/services/controller.yml +++ b/Resources/config/services/controller.yml @@ -9,3 +9,7 @@ services: Chill\PersonBundle\Controller\TimelinePersonController: arguments: $eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface' + + Chill\PersonBundle\Controller\AccompanyingPeriodController: + arguments: + $eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'