summaryrefslogtreecommitdiff
path: root/app/Job/SubtaskEventJob.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-07-17 20:33:27 -0400
committerFrederic Guillot <fred@kanboard.net>2016-07-17 20:33:27 -0400
commitd9d37882228771bca0c7f53f5ffcef90ba7ac1c5 (patch)
treef5df4446273878fc0bc9bf6e6db4bef1535b9de3 /app/Job/SubtaskEventJob.php
parentcbe52e57200a66522d88dfc5d5f46de8eb87ffb2 (diff)
Subtasks events refactoring and show delete in activity stream
Diffstat (limited to 'app/Job/SubtaskEventJob.php')
-rw-r--r--app/Job/SubtaskEventJob.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/app/Job/SubtaskEventJob.php b/app/Job/SubtaskEventJob.php
new file mode 100644
index 00000000..1dc243ef
--- /dev/null
+++ b/app/Job/SubtaskEventJob.php
@@ -0,0 +1,48 @@
+<?php
+
+namespace Kanboard\Job;
+
+use Kanboard\EventBuilder\SubtaskEventBuilder;
+
+/**
+ * Class SubtaskEventJob
+ *
+ * @package Kanboard\Job
+ * @author Frederic Guillot
+ */
+class SubtaskEventJob extends BaseJob
+{
+ /**
+ * Set job params
+ *
+ * @param int $subtaskId
+ * @param string $eventName
+ * @param array $values
+ * @return $this
+ */
+ public function withParams($subtaskId, $eventName, array $values = array())
+ {
+ $this->jobParams = array($subtaskId, $eventName, $values);
+ return $this;
+ }
+
+ /**
+ * Execute job
+ *
+ * @param int $subtaskId
+ * @param string $eventName
+ * @param array $values
+ * @return $this
+ */
+ public function execute($subtaskId, $eventName, array $values = array())
+ {
+ $event = SubtaskEventBuilder::getInstance($this->container)
+ ->withSubtaskId($subtaskId)
+ ->withValues($values)
+ ->build();
+
+ if ($event !== null) {
+ $this->dispatcher->dispatch($eventName, $event);
+ }
+ }
+}