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 list / view
- add privacy events to report edit / update

View File

@ -407,7 +407,7 @@ class ReportController extends Controller
$event = new PrivacyEvent($person, array( $event = new PrivacyEvent($person, array(
'element_class' => Report::class, 'element_class' => Report::class,
'element_id' => intval($report_id), 'element_id' => $entity->getId(),
'action' => 'view' 'action' => 'view'
)); ));
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event); $this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
@ -446,6 +446,13 @@ class ReportController extends Controller
$person = $report->getPerson(); $person = $report->getPerson();
$editForm = $this->createEditForm($report); $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( return $this->render('ChillReportBundle:Report:edit.html.twig', array(
'edit_form' => $editForm->createView(), 'edit_form' => $editForm->createView(),
@ -507,7 +514,16 @@ class ReportController extends Controller
$this->get('translator') $this->get('translator')
->trans('Success : report updated!') ->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', return $this->redirect($this->generateUrl('report_view',
array('person_id' => $report->getPerson()->getId(), 'report_id' => $report_id))); array('person_id' => $report->getPerson()->getId(), 'report_id' => $report_id)));
} }