summaryrefslogtreecommitdiff
path: root/app/Job
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-07-23 14:05:15 -0400
committerFrederic Guillot <fred@kanboard.net>2016-07-23 14:05:15 -0400
commitb6119e7dee84869a619dedccd9c80df4422a4f5b (patch)
tree8487400f592d2c66dba91a9ce4f03b4ae657a0c2 /app/Job
parent5fe81ae6ef59ee73e7d6f34fb333d3d19a08a266 (diff)
Added internal task links to activity stream
Diffstat (limited to 'app/Job')
-rw-r--r--app/Job/TaskLinkEventJob.php45
1 files changed, 45 insertions, 0 deletions
diff --git a/app/Job/TaskLinkEventJob.php b/app/Job/TaskLinkEventJob.php
new file mode 100644
index 00000000..669608ad
--- /dev/null
+++ b/app/Job/TaskLinkEventJob.php
@@ -0,0 +1,45 @@
+<?php
+
+namespace Kanboard\Job;
+
+use Kanboard\EventBuilder\TaskLinkEventBuilder;
+
+/**
+ * Class TaskLinkEventJob
+ *
+ * @package Kanboard\Job
+ * @author Frederic Guillot
+ */
+class TaskLinkEventJob extends BaseJob
+{
+ /**
+ * Set job params
+ *
+ * @param int $taskLinkId
+ * @param string $eventName
+ * @return $this
+ */
+ public function withParams($taskLinkId, $eventName)
+ {
+ $this->jobParams = array($taskLinkId, $eventName);
+ return $this;
+ }
+
+ /**
+ * Execute job
+ *
+ * @param int $taskLinkId
+ * @param string $eventName
+ * @return $this
+ */
+ public function execute($taskLinkId, $eventName)
+ {
+ $event = TaskLinkEventBuilder::getInstance($this->container)
+ ->withTaskLinkId($taskLinkId)
+ ->build();
+
+ if ($event !== null) {
+ $this->dispatcher->dispatch($eventName, $event);
+ }
+ }
+}