mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 02:23:51 +00:00
add task type in list
This commit is contained in:
@@ -45,6 +45,10 @@ class DefaultTaskDefinition implements \Chill\TaskBundle\Workflow\TaskWorkflowDe
|
||||
'sentence' => '%user% has started the task'
|
||||
]
|
||||
];
|
||||
|
||||
const DEFINITION_METADATA = [
|
||||
'name' => 'Default task'
|
||||
];
|
||||
|
||||
public function supports(AbstractTask $task)
|
||||
{
|
||||
@@ -71,20 +75,21 @@ class DefaultTaskDefinition implements \Chill\TaskBundle\Workflow\TaskWorkflowDe
|
||||
}
|
||||
|
||||
return $this->getTransitionMetadata(\implode('.', \array_slice($keys, 1)), $metadataSubject);
|
||||
case 'definition':
|
||||
return self::DEFINITION_METADATA[$keys[1]] ?? $key;
|
||||
default:
|
||||
throw new \LogicException("this key '$key' is not implemented");
|
||||
return $key;
|
||||
}
|
||||
}
|
||||
|
||||
protected function getTransitionMetadata($key, Transition $transition)
|
||||
{
|
||||
if (!\array_key_exists($transition->getName(), self::TRANSITION_METADATA)) {
|
||||
throw new \LogicException("the metadata for this transition are not defined");
|
||||
return $key;
|
||||
}
|
||||
|
||||
if (!\array_key_exists($key, self::TRANSITION_METADATA[$transition->getName()])) {
|
||||
throw new \LogicException("The metadata ".$key." is not "
|
||||
. "defined for the transition ".$transition.getName());
|
||||
return $key;
|
||||
}
|
||||
|
||||
return self::TRANSITION_METADATA[$transition->getName()][$key];
|
||||
|
Reference in New Issue
Block a user