diff options
author | Teamjungla{CODE} <junglacode@gmail.com> | 2016-08-20 13:47:12 -0500 |
---|---|---|
committer | Teamjungla{CODE} <junglacode@gmail.com> | 2016-08-20 13:47:12 -0500 |
commit | fe8e9cdcfe3afc1475c7e7f4392d2b2cc601a12b (patch) | |
tree | 001403874e9e3716de7c6d51a9f536e9b3c3be5e /app/Job/ProjectFileEventJob.php | |
parent | b1e795fc5b45369f7b9b565b1e106d2673361977 (diff) | |
parent | 98efcf21e355ed6ac3827058b99df86ca67c75bb (diff) |
Merge branch 'stable' of https://github.com/kanboard/kanboard
Diffstat (limited to 'app/Job/ProjectFileEventJob.php')
-rw-r--r-- | app/Job/ProjectFileEventJob.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/app/Job/ProjectFileEventJob.php b/app/Job/ProjectFileEventJob.php new file mode 100644 index 00000000..45e6ece3 --- /dev/null +++ b/app/Job/ProjectFileEventJob.php @@ -0,0 +1,45 @@ +<?php + +namespace Kanboard\Job; + +use Kanboard\EventBuilder\ProjectFileEventBuilder; + +/** + * Class ProjectFileEventJob + * + * @package Kanboard\Job + * @author Frederic Guillot + */ +class ProjectFileEventJob extends BaseJob +{ + /** + * Set job params + * + * @param int $fileId + * @param string $eventName + * @return $this + */ + public function withParams($fileId, $eventName) + { + $this->jobParams = array($fileId, $eventName); + return $this; + } + + /** + * Execute job + * + * @param int $fileId + * @param string $eventName + * @return $this + */ + public function execute($fileId, $eventName) + { + $event = ProjectFileEventBuilder::getInstance($this->container) + ->withFileId($fileId) + ->buildEvent(); + + if ($event !== null) { + $this->dispatcher->dispatch($eventName, $event); + } + } +} |