summaryrefslogtreecommitdiff
path: root/app/Subscriber/TaskMovedDateSubscriber.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-02-11 21:05:23 -0500
committerFrederic Guillot <fred@kanboard.net>2015-02-11 21:05:23 -0500
commit1a8ca671b5a58dcdf45ed8c165d49e5dd5a2e9a6 (patch)
treef2d1ae2f5c590a2558eec58436589dcc326f48f2 /app/Subscriber/TaskMovedDateSubscriber.php
parent7f820a52b07de25296609eabf46e49acb424eeba (diff)
Add subscriber for task (moved date)
Diffstat (limited to 'app/Subscriber/TaskMovedDateSubscriber.php')
-rw-r--r--app/Subscriber/TaskMovedDateSubscriber.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/Subscriber/TaskMovedDateSubscriber.php b/app/Subscriber/TaskMovedDateSubscriber.php
new file mode 100644
index 00000000..0e36acfa
--- /dev/null
+++ b/app/Subscriber/TaskMovedDateSubscriber.php
@@ -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()));
+ }
+ }
+}