Subtasks events refactoring and show delete in activity stream
This commit is contained in:
48
app/Job/SubtaskEventJob.php
Normal file
48
app/Job/SubtaskEventJob.php
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user