diff options
Diffstat (limited to 'app/Job/SubtaskEventJob.php')
-rw-r--r-- | app/Job/SubtaskEventJob.php | 48 |
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..85c4d73e --- /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) + ->buildEvent(); + + if ($event !== null) { + $this->dispatcher->dispatch($eventName, $event); + } + } +} |