mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 10:33:49 +00:00
improve autowiring and add workflow to tasks
This commit is contained in:
@@ -8,6 +8,7 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
use Symfony\Component\DependencyInjection\Loader;
|
||||
use Chill\TaskBundle\Security\Authorization\TaskVoter;
|
||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||
use Chill\TaskBundle\Workflow\TaskWorkflowManager;
|
||||
|
||||
/**
|
||||
* This is the class that loads and manages your bundle configuration.
|
||||
@@ -28,11 +29,26 @@ class ChillTaskExtension extends Extension implements PrependExtensionInterface
|
||||
$loader->load('services/controller.yml');
|
||||
$loader->load('services/security.yml');
|
||||
$loader->load('services/repositories.yml');
|
||||
$loader->load('services/workflow.yml');
|
||||
}
|
||||
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
$this->prependAuthorization($container);
|
||||
$this->prependRoute($container);
|
||||
$this->prependWorkflows($container);
|
||||
}
|
||||
|
||||
protected function prependRoute(ContainerBuilder $container)
|
||||
{
|
||||
//declare routes for task bundle
|
||||
$container->prependExtensionConfig('chill_main', array(
|
||||
'routing' => array(
|
||||
'resources' => array(
|
||||
'@ChillTaskBundle/Resources/config/routing.yml'
|
||||
)
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
public function prependAuthorization(ContainerBuilder $container)
|
||||
@@ -44,5 +60,38 @@ class ChillTaskExtension extends Extension implements PrependExtensionInterface
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
protected function prependWorkflows(ContainerBuilder $container)
|
||||
{
|
||||
$container->prependExtensionConfig('framework', [
|
||||
'workflows' => [
|
||||
'task_default' => [
|
||||
'marking_store' => [
|
||||
'type' => 'multiple_state',
|
||||
'arguments' => [
|
||||
'currentStates'
|
||||
],
|
||||
],
|
||||
'type' => 'workflow',
|
||||
'support_strategy' => TaskWorkflowManager::class,
|
||||
'places' => [ 'new', 'in_progress', 'closed', 'canceled'],
|
||||
'initial_place' => 'new',
|
||||
'transitions' => [
|
||||
'start' => [
|
||||
'from' => 'new',
|
||||
'to' => 'in_progress'
|
||||
],
|
||||
'close' => [
|
||||
'from' => 'in_progress',
|
||||
'to' => 'closed'
|
||||
],
|
||||
'cancel' => [
|
||||
'from' => ['new', 'in_progress'],
|
||||
'to' => 'canceled'
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user