| <?php |
|
|
| namespace Kanboard\Job; |
|
|
| use Kanboard\Event\TaskEvent; |
| use Kanboard\EventBuilder\TaskEventBuilder; |
| use Kanboard\Model\TaskModel; |
|
|
| |
| |
| |
| |
| |
| |
| class TaskEventJob extends BaseJob |
| { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| public function withParams($taskId, array $eventNames, array $changes = array(), array $values = array(), array $task = array()) |
| { |
| $this->jobParams = array($taskId, $eventNames, $changes, $values, $task); |
| return $this; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| public function execute($taskId, array $eventNames, array $changes = array(), array $values = array(), array $task = array()) |
| { |
| $event = TaskEventBuilder::getInstance($this->container) |
| ->withTaskId($taskId) |
| ->withChanges($changes) |
| ->withValues($values) |
| ->withTask($task) |
| ->buildEvent(); |
|
|
| if ($event !== null) { |
| foreach ($eventNames as $eventName) { |
| $this->fireEvent($eventName, $event); |
| } |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| protected function fireEvent($eventName, TaskEvent $event) |
| { |
| $this->logger->debug(__METHOD__.' Event fired: '.$eventName); |
| $this->dispatcher->dispatch($event, $eventName); |
|
|
| if ($eventName === TaskModel::EVENT_CREATE) { |
| $userMentionJob = $this->userMentionJob->withParams($event['task']['description'], TaskModel::EVENT_USER_MENTION, $event); |
| $this->queueManager->push($userMentionJob); |
| } |
| } |
| } |
|
|