diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-01-16 21:06:36 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-01-16 21:06:36 -0500 |
commit | 6a7b8ec60f265413ca88878dba6180456257d370 (patch) | |
tree | 5b36bf3122d6884cb09b66e623e28768e92ed9ba /app/Subscriber/SubtaskTimeTrackingSubscriber.php | |
parent | 6a0895ef765ea7b83df02bb9789fda7415dee9a5 (diff) |
Make sure that some event subscribers are not executed multiple times
Diffstat (limited to 'app/Subscriber/SubtaskTimeTrackingSubscriber.php')
-rw-r--r-- | app/Subscriber/SubtaskTimeTrackingSubscriber.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/Subscriber/SubtaskTimeTrackingSubscriber.php b/app/Subscriber/SubtaskTimeTrackingSubscriber.php index b5e0354d..5e4b2225 100644 --- a/app/Subscriber/SubtaskTimeTrackingSubscriber.php +++ b/app/Subscriber/SubtaskTimeTrackingSubscriber.php @@ -6,13 +6,13 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Kanboard\Model\Subtask; use Kanboard\Event\SubtaskEvent; -class SubtaskTimeTrackingSubscriber extends \Kanboard\Core\Base implements EventSubscriberInterface +class SubtaskTimeTrackingSubscriber extends BaseSubscriber implements EventSubscriberInterface { public static function getSubscribedEvents() { return array( - Subtask::EVENT_CREATE => array('updateTaskTime', 0), - Subtask::EVENT_DELETE => array('updateTaskTime', 0), + Subtask::EVENT_CREATE => 'updateTaskTime', + Subtask::EVENT_DELETE => 'updateTaskTime', Subtask::EVENT_UPDATE => array( array('logStartEnd', 10), array('updateTaskTime', 0), @@ -23,6 +23,7 @@ class SubtaskTimeTrackingSubscriber extends \Kanboard\Core\Base implements Event public function updateTaskTime(SubtaskEvent $event) { if (isset($event['task_id'])) { + $this->logger->debug('Subscriber executed: '.__CLASS__.'::'.__METHOD__); $this->subtaskTimeTracking->updateTaskTimeTracking($event['task_id']); } } @@ -30,6 +31,7 @@ class SubtaskTimeTrackingSubscriber extends \Kanboard\Core\Base implements Event public function logStartEnd(SubtaskEvent $event) { if (isset($event['status']) && $this->config->get('subtask_time_tracking') == 1) { + $this->logger->debug('Subscriber executed: '.__CLASS__.'::'.__METHOD__); $subtask = $this->subtask->getById($event['id']); if (empty($subtask['user_id'])) { |