1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kanboard_ynh.git synced 2024-09-03 19:36:17 +02:00
kanboard_ynh/sources/app/Subscriber/ProjectDailySummarySubscriber.php
2016-01-24 17:50:52 +01:00

30 lines
983 B
PHP

<?php
namespace Kanboard\Subscriber;
use Kanboard\Event\TaskEvent;
use Kanboard\Model\Task;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class ProjectDailySummarySubscriber extends BaseSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
return array(
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']) && !$this->isExecuted()) {
$this->logger->debug('Subscriber executed: '.__METHOD__);
$this->projectDailyColumnStats->updateTotals($event['project_id'], date('Y-m-d'));
$this->projectDailyStats->updateTotals($event['project_id'], date('Y-m-d'));
}
}
}