Make sure that some event subscribers are not executed multiple times
This commit is contained in:
@@ -6,22 +6,23 @@ use Kanboard\Event\TaskEvent;
|
||||
use Kanboard\Model\Task;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
class ProjectDailySummarySubscriber extends \Kanboard\Core\Base implements EventSubscriberInterface
|
||||
class ProjectDailySummarySubscriber extends BaseSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
Task::EVENT_CREATE_UPDATE => array('execute', 0),
|
||||
Task::EVENT_CLOSE => array('execute', 0),
|
||||
Task::EVENT_OPEN => array('execute', 0),
|
||||
Task::EVENT_MOVE_COLUMN => array('execute', 0),
|
||||
Task::EVENT_MOVE_SWIMLANE => array('execute', 0),
|
||||
Task::EVENT_CREATE_UPDATE => 'execute',
|
||||
Task::EVENT_CLOSE => 'execute',
|
||||
Task::EVENT_OPEN => 'execute',
|
||||
Task::EVENT_MOVE_COLUMN => 'execute',
|
||||
Task::EVENT_MOVE_SWIMLANE => 'execute',
|
||||
);
|
||||
}
|
||||
|
||||
public function execute(TaskEvent $event)
|
||||
{
|
||||
if (isset($event['project_id'])) {
|
||||
if (isset($event['project_id']) && !$this->isExecuted()) {
|
||||
$this->logger->debug('Subscriber executed: '.__CLASS__.'::'.__METHOD__);
|
||||
$this->projectDailyColumnStats->updateTotals($event['project_id'], date('Y-m-d'));
|
||||
$this->projectDailyStats->updateTotals($event['project_id'], date('Y-m-d'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user