Add subscriber for task (moved date)
This commit is contained in:
parent
7f820a52b0
commit
1a8ca671b5
|
|
@ -31,10 +31,6 @@ class TaskPosition extends Base
|
|||
|
||||
if ($result) {
|
||||
|
||||
if ($original_task['column_id'] != $column_id) {
|
||||
$this->db->table(Task::TABLE)->eq('id', $task_id)->update(array('date_moved' => time()));
|
||||
}
|
||||
|
||||
if ($original_task['swimlane_id'] != $swimlane_id) {
|
||||
$this->calculateAndSave($project_id, 0, $column_id, 1, $original_task['swimlane_id']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ use Subscriber\ProjectDailySummarySubscriber;
|
|||
use Subscriber\ProjectModificationDateSubscriber;
|
||||
use Subscriber\WebhookSubscriber;
|
||||
use Subscriber\SubtaskTimesheetSubscriber;
|
||||
use Subscriber\TaskMovedDateSubscriber;
|
||||
|
||||
class EventDispatcherProvider implements ServiceProviderInterface
|
||||
{
|
||||
|
|
@ -27,6 +28,7 @@ class EventDispatcherProvider implements ServiceProviderInterface
|
|||
$container['dispatcher']->addSubscriber(new WebhookSubscriber($container));
|
||||
$container['dispatcher']->addSubscriber(new NotificationSubscriber($container));
|
||||
$container['dispatcher']->addSubscriber(new SubtaskTimesheetSubscriber($container));
|
||||
$container['dispatcher']->addSubscriber(new TaskMovedDateSubscriber($container));
|
||||
|
||||
// Automatic actions
|
||||
$container['action']->attachEvents();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Subscriber;
|
||||
|
||||
use Event\TaskEvent;
|
||||
use Model\Task;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
class TaskMovedDateSubscriber extends Base implements EventSubscriberInterface
|
||||
{
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
Task::EVENT_MOVE_COLUMN => array('execute', 0),
|
||||
);
|
||||
}
|
||||
|
||||
public function execute(TaskEvent $event)
|
||||
{
|
||||
if (isset($event['task_id'])) {
|
||||
$this->container['db']->table(Task::TABLE)->eq('id', $event['task_id'])->update(array('date_moved' => time()));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue