add privacyEvent for edit and update singleTask

This commit is contained in:
Mat 2018-10-23 10:42:23 +02:00
parent 508e8ae7fb
commit 9c51d673f0
2 changed files with 17 additions and 2 deletions

View File

@ -12,4 +12,5 @@ PrivacyEvent branch
===================
- add privacy events to task show / list;
- add privacy events to task edit / update;

View File

@ -156,7 +156,7 @@ class SingleTaskController extends Controller
$event = new PrivacyEvent($person, array(
'element_class' => SingleTask::class,
'element_id' => intval($id),
'element_id' => $task->getId(),
'action' => 'show'
));
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
@ -224,6 +224,13 @@ class SingleTaskController extends Controller
$this->addFlash('success', $translator
->trans("The task has been updated"));
$event = new PrivacyEvent($person, array(
'element_class' => SingleTask::class,
'element_id' => $task->getId(),
'action' => 'update'
));
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
return $this->redirectToRoute(
'chill_task_singletask_list',
@ -240,7 +247,14 @@ class SingleTaskController extends Controller
if ($event->hasResponse()) {
return $event->getResponse();
}
$event = new PrivacyEvent($person, array(
'element_class' => SingleTask::class,
'element_id' => $task->getId(),
'action' => 'edit'
));
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
return $this->render('ChillTaskBundle:SingleTask:edit.html.twig', array(
'task' => $task,
'form' => $form->createView()