From b6ab04f3e31fa6a2e09fd4639507f8c22f0c5dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 19 Oct 2018 12:36:59 +0200 Subject: [PATCH] add privacy event to edit, update actions --- Controller/ActivityController.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Controller/ActivityController.php b/Controller/ActivityController.php index 80007f415..54f50c4af 100644 --- a/Controller/ActivityController.php +++ b/Controller/ActivityController.php @@ -28,7 +28,6 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Security\Core\Role\Role; - use Chill\ActivityBundle\Entity\Activity; use Chill\PersonBundle\Entity\Person; use Chill\ActivityBundle\Form\ActivityType; @@ -226,7 +225,7 @@ class ActivityController extends Controller $event = new PrivacyEvent($person, array( 'element_class' => Activity::class, - 'element_id' => intval($id), + 'element_id' => $entity->getId(), 'action' => 'show' )); $this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); @@ -263,6 +262,13 @@ class ActivityController extends Controller $editForm = $this->createEditForm($entity); $deleteForm = $this->createDeleteForm($id, $person); + + $event = new PrivacyEvent($person, array( + 'element_class' => Activity::class, + 'element_id' => $entity->getId(), + 'action' => 'show' + )); + $this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); return $this->render('ChillActivityBundle:Activity:edit.html.twig', array( 'entity' => $entity, @@ -314,6 +320,13 @@ class ActivityController extends Controller $deleteForm = $this->createDeleteForm($id, $person); $editForm = $this->createEditForm($entity); $editForm->handleRequest($request); + + $event = new PrivacyEvent($person, array( + 'element_class' => Activity::class, + 'element_id' => $entity->getId(), + 'action' => 'update' + )); + $this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); if ($editForm->isValid()) { $em->flush();