mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-27 18:13:48 +00:00
add closed tasks
- the entity has a new column / property "closed" (boolean) - An event listener in created during container compilation, which listen on tasks status changed - The taskworkflow manager and task workflow definition indicate if the tasks is closed ; - Add list for closed tasks in controller, and change parameter 'date_status' to 'status'; - and change query to allow to filter on closed tasks
This commit is contained in:
@@ -53,7 +53,7 @@ class DefaultTaskDefinition implements \Chill\TaskBundle\Workflow\TaskWorkflowDe
|
||||
&& $task->getType() === 'task_default';
|
||||
}
|
||||
|
||||
public function getAssociatedWorkflowName()
|
||||
public static function getAssociatedWorkflowName()
|
||||
{
|
||||
return 'task_default';
|
||||
}
|
||||
@@ -89,4 +89,10 @@ class DefaultTaskDefinition implements \Chill\TaskBundle\Workflow\TaskWorkflowDe
|
||||
|
||||
return self::TRANSITION_METADATA[$transition->getName()][$key];
|
||||
}
|
||||
|
||||
public function isClosed(AbstractTask $task)
|
||||
{
|
||||
return \array_key_exists('closed', $task->getCurrentStates())
|
||||
|| \array_key_exists('canceled', $task->getCurrentStates());
|
||||
}
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ namespace Chill\TaskBundle\Workflow;
|
||||
use Chill\TaskBundle\Entity\AbstractTask;
|
||||
use Symfony\Component\Workflow\SupportStrategy\SupportStrategyInterface;
|
||||
use Symfony\Component\Workflow\Workflow;
|
||||
use Symfony\Component\Workflow\Event\Event;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -80,4 +81,15 @@ class TaskWorkflowManager implements SupportStrategyInterface
|
||||
return $this->getTaskWorkflowDefinition($task)
|
||||
->getWorkflowMetadata($key, $metadataSubject);
|
||||
}
|
||||
|
||||
public function onTaskStateEntered(Event $e)
|
||||
{
|
||||
$task = $e->getSubject();
|
||||
|
||||
$definition = $this->getTaskWorkflowDefinition($task);
|
||||
|
||||
$task->setClosed($definition->isClosed($task));
|
||||
|
||||
dump($task);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user