From a9522d5b4b5150e384cf17732301d70257009374 Mon Sep 17 00:00:00 2001 From: Tchama Date: Wed, 16 Jan 2019 16:27:03 +0100 Subject: [PATCH] add eventDispatcher for new page --- Controller/EventController.php | 23 +++++++++++++++++++++ DependencyInjection/ChillEventExtension.php | 1 + Resources/config/services/controller.yml | 5 +++++ 3 files changed, 29 insertions(+) create mode 100644 Resources/config/services/controller.yml diff --git a/Controller/EventController.php b/Controller/EventController.php index 474e2b14b..49f438713 100644 --- a/Controller/EventController.php +++ b/Controller/EventController.php @@ -3,6 +3,8 @@ namespace Chill\EventBundle\Controller; use Chill\EventBundle\Entity\Participation; +use Chill\PersonBundle\Privacy\PrivacyEvent; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Chill\PersonBundle\Form\Type\PickPersonType; @@ -20,6 +22,21 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType; */ class EventController extends Controller { + /** + * @var EventDispatcherInterface + */ + protected $eventDispatcher; + + /** + * EventController constructor. + * + * @param EventDispatcherInterface $eventDispatcher + */ + public function __construct(EventDispatcherInterface $eventDispatcher) + { + $this->eventDispatcher = $eventDispatcher; + } + public function mostRecentIndexAction() { @@ -247,6 +264,12 @@ class EventController extends Controller array('person' => $person) ); + $privacyEvent = new PrivacyEvent($person, array( + 'element_class' => Participation::class, + 'action' => 'list' + )); + $this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $privacyEvent); + return $this->render('ChillEventBundle:Event:listByPerson.html.twig', array( 'participations' => $participations, 'person' => $person diff --git a/DependencyInjection/ChillEventExtension.php b/DependencyInjection/ChillEventExtension.php index 1026b1e08..8fe36b2e4 100644 --- a/DependencyInjection/ChillEventExtension.php +++ b/DependencyInjection/ChillEventExtension.php @@ -32,6 +32,7 @@ class ChillEventExtension extends Extension implements PrependExtensionInterface $loader->load('forms.yml'); $loader->load('fixtures.yml'); $loader->load('menu.yml'); + $loader->load('controller.yml'); } /* (non-PHPdoc) diff --git a/Resources/config/services/controller.yml b/Resources/config/services/controller.yml new file mode 100644 index 000000000..341bc9dcb --- /dev/null +++ b/Resources/config/services/controller.yml @@ -0,0 +1,5 @@ +services: + Chill\EventBundle\Controller\EventController: + arguments: + $eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface' + tags: ['controller.service_arguments']