mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
privacyEvent: remove element parameter
This commit is contained in:
parent
5f36a62379
commit
6324eceb1b
@ -56,7 +56,7 @@ class AccompanyingPeriodController extends Controller
|
||||
|
||||
$person = $this->_getPerson($person_id);
|
||||
|
||||
$event = new PrivacyEvent($person, null, array(
|
||||
$event = new PrivacyEvent($person, array(
|
||||
'element_class' => AccompanyingPeriod::class,
|
||||
'action' => 'list'
|
||||
));
|
||||
|
@ -71,7 +71,7 @@ class TimelinePersonController extends Controller
|
||||
|
||||
$paginator = $paginatorFactory->create($nbItems);
|
||||
|
||||
$event = new PrivacyEvent($person);
|
||||
$event = new PrivacyEvent($person, array('action' => 'timeline'));
|
||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||
|
||||
return $this->render('ChillPersonBundle:Timeline:index.html.twig', array
|
||||
|
@ -25,6 +25,14 @@ namespace Chill\PersonBundle\Privacy;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
|
||||
/**
|
||||
* Class PrivacyEvent
|
||||
*
|
||||
* Array $args expects arguments with the following keys: 'element_class', 'element_id', 'action'
|
||||
* By default, action is set to 'show'
|
||||
*
|
||||
* @package Chill\PersonBundle\Privacy
|
||||
*/
|
||||
class PrivacyEvent extends Event
|
||||
{
|
||||
const PERSON_PRIVACY_EVENT = 'chill_person.privacy_event';
|
||||
@ -34,11 +42,6 @@ class PrivacyEvent extends Event
|
||||
*/
|
||||
private $person;
|
||||
|
||||
/**
|
||||
* @var Object
|
||||
*/
|
||||
private $element;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
@ -53,13 +56,11 @@ class PrivacyEvent extends Event
|
||||
* PrivacyEvent constructor.
|
||||
*
|
||||
* @param Person $person
|
||||
* @param object $element
|
||||
* @param array $args
|
||||
*/
|
||||
public function __construct(Person $person, object $element = null, array $args = array('action' => 'show'))
|
||||
public function __construct(Person $person, array $args = array('action' => 'show'))
|
||||
{
|
||||
$this->person = $person;
|
||||
$this->element = $element;
|
||||
$this->args = $args;
|
||||
$this->persons = array();
|
||||
}
|
||||
@ -95,15 +96,7 @@ class PrivacyEvent extends Event
|
||||
*/
|
||||
public function hasPersons()
|
||||
{
|
||||
return (count($this->persons) >= 1 ? true : false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Object
|
||||
*/
|
||||
public function getElement()
|
||||
{
|
||||
return $this->element;
|
||||
return count($this->persons) >= 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -69,15 +69,17 @@ class PrivacyEventSubscriber implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
$this->logger->notice("[Privacy Event] A Person Folder has been viewed", array(
|
||||
$involved = array(
|
||||
'by_user' => $this->token->getToken()->getUser()->getUsername(),
|
||||
'by_user_id' => $this->token->getToken()->getUser()->getId(),
|
||||
'person_id' => $event->getPerson()->getId(),
|
||||
'persons' => $persons,
|
||||
'element_class' => $event->getArgs()['element_class'],
|
||||
'element_id' => intval($event->getArgs()['element_id']),
|
||||
'action' => $event->getArgs()['action']
|
||||
));
|
||||
);
|
||||
|
||||
$this->logger->notice(
|
||||
"[Privacy Event] A Person Folder has been viewed",
|
||||
array_merge($involved, $event->getArgs())
|
||||
);
|
||||
|
||||
dump($event);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user