Subtasks events refactoring and show delete in activity stream

This commit is contained in:
Frederic Guillot
2016-07-17 20:33:27 -04:00
parent cbe52e5720
commit d9d3788222
17 changed files with 339 additions and 97 deletions

View File

@@ -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);
}
}
}