add eventDispatcher for new page

This commit is contained in:
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