add eventDispatcher for new page

This commit is contained in:
Tchama 2019-01-16 16:27:03 +01:00
parent 735425f2fd
commit a9522d5b4b
3 changed files with 29 additions and 0 deletions

View File

@ -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

View File

@ -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)

View File

@ -0,0 +1,5 @@
services:
Chill\EventBundle\Controller\EventController:
arguments:
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
tags: ['controller.service_arguments']