summaryrefslogtreecommitdiff
path: root/app/Job
diff options
context:
space:
mode:
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);
+ }
+ }
+}