record single task states transition and add them in timeline

This commit is contained in:
2018-05-03 23:38:08 +02:00
parent 57169b3148
commit 86f7188d4a
17 changed files with 645 additions and 7 deletions

View File

@@ -32,6 +32,8 @@ class ChillTaskExtension extends Extension implements PrependExtensionInterface
$loader->load('services/workflow.yml');
$loader->load('services/templating.yml');
$loader->load('services/menu.yml');
$loader->load('services/event.yml');
$loader->load('services/timeline.yml');
}
public function prepend(ContainerBuilder $container)

View File

@@ -22,6 +22,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
use Chill\TaskBundle\Workflow\TaskWorkflowManager;
use Symfony\Component\DependencyInjection\Reference;
use Chill\TaskBundle\Templating\UI\CountNotificationTask;
use Chill\TaskBundle\Event\Lifecycle\TaskLifecycleEvent;
/**
*
@@ -39,6 +40,7 @@ class TaskWorkflowDefinitionCompilerPass implements CompilerPassInterface
$workflowManagerDefinition = $container->getDefinition(TaskWorkflowManager::class);
$counterDefinition = $container->getDefinition(CountNotificationTask::class);
$lifecycleDefinition = $container->getDefinition(TaskLifecycleEvent::class);
foreach ($container->findTaggedServiceIds('chill_task.workflow_definition') as $id => $tags) {
// registering the definition to manager
@@ -58,6 +60,12 @@ class TaskWorkflowDefinitionCompilerPass implements CompilerPassInterface
'method' => 'resetCacheOnNewStates',
'priority' => 0
]);
$lifecycleDefinition
->addTag('kernel.event_listener', [
'event' => sprintf('workflow.%s.transition', $definition->getClass()::getAssociatedWorkflowName()),
'method' => 'onTransition',
'priority' => 0
]);
}
}
}