From ee19c626485037adb57ae85b0cba598d37bd0010 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 16 Jan 2016 21:35:25 -0500 Subject: Allow one call by event --- app/Subscriber/BaseSubscriber.php | 10 +++++----- app/Subscriber/NotificationSubscriber.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'app/Subscriber') diff --git a/app/Subscriber/BaseSubscriber.php b/app/Subscriber/BaseSubscriber.php index 875c5e26..2e41da76 100644 --- a/app/Subscriber/BaseSubscriber.php +++ b/app/Subscriber/BaseSubscriber.php @@ -21,19 +21,19 @@ class BaseSubscriber extends Base private $called = array(); /** - * Check if a method has been executed + * Check if a listener has been executed * * @access public - * @param string $method + * @param string $key * @return boolean */ - public function isExecuted($method = '') + public function isExecuted($key = '') { - if (isset($this->called[$method])) { + if (isset($this->called[$key])) { return true; } - $this->called[$method] = true; + $this->called[$key] = true; return false; } diff --git a/app/Subscriber/NotificationSubscriber.php b/app/Subscriber/NotificationSubscriber.php index 6c24b08c..d3afc13a 100644 --- a/app/Subscriber/NotificationSubscriber.php +++ b/app/Subscriber/NotificationSubscriber.php @@ -34,7 +34,7 @@ class NotificationSubscriber extends BaseSubscriber implements EventSubscriberIn public function handleEvent(GenericEvent $event, $event_name) { - if (! $this->isExecuted()) { + if (! $this->isExecuted($event_name)) { $this->logger->debug('Subscriber executed: '.__CLASS__.'::'.__METHOD__); $event_data = $this->getEventData($event); -- cgit v1.2.3