add privacyEvents for report edit and update

This commit is contained in:
Mat 2018-10-23 10:31:20 +02:00
parent a3a4d31f8b
commit f0a0f46ff1
2 changed files with 19 additions and 2 deletions

View File

@ -9,4 +9,5 @@ PrivacyEvent branch
===================
- add privacy events to report list / view
- add privacy events to report edit / update

View File

@ -407,7 +407,7 @@ class ReportController extends Controller
$event = new PrivacyEvent($person, array(
'element_class' => Report::class,
'element_id' => intval($report_id),
'element_id' => $entity->getId(),
'action' => 'view'
));
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
@ -447,6 +447,13 @@ class ReportController extends Controller
$editForm = $this->createEditForm($report);
$event = new PrivacyEvent($person, array(
'element_class' => Report::class,
'element_id' => $report->getId(),
'action' => 'edit'
));
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
return $this->render('ChillReportBundle:Report:edit.html.twig', array(
'edit_form' => $editForm->createView(),
'person' => $person,
@ -508,6 +515,15 @@ class ReportController extends Controller
->trans('Success : report updated!')
);
$person = $report->getPerson();
$event = new PrivacyEvent($person, array(
'element_class' => Report::class,
'element_id' => $report->getId(),
'action' => 'update'
));
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
return $this->redirect($this->generateUrl('report_view',
array('person_id' => $report->getPerson()->getId(), 'report_id' => $report_id)));
}