Skip to content
Permalink
Browse files

minor #20478 [Workflow] Removed definition builder (Nyholm)

This PR was squashed before being merged into the 3.2-dev branch (closes #20478).

Discussion
----------

[Workflow] Removed definition builder

| Q             | A
| ------------- | ---
| Branch?       | "master"
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

As of @xabbuh comment in #20451 (comment)

We do not really need the definition builder here.

Commits
-------

caa3d6f [Workflow] Removed definition builder
  • Loading branch information...
lyrixx committed Nov 10, 2016
2 parents f8fb91b + caa3d6f commit e269ca5d276c6851d90999b38d2f677314893a76
Showing with 5 additions and 6 deletions.
  1. +5 −6 src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -406,16 +406,14 @@ private function registerWorkflowConfiguration(array $workflows, ContainerBuilde
foreach ($workflows as $name => $workflow) {
$type = $workflow['type'];
// Create a DefinitionBuilder
$definitionBuilderDefinition = new Definition(Workflow\DefinitionBuilder::class);
$definitionBuilderDefinition->addMethodCall('addPlaces', array($workflow['places']));
$transitions = array();
foreach ($workflow['transitions'] as $transitionName => $transition) {
if ($type === 'workflow') {
$definitionBuilderDefinition->addMethodCall('addTransition', array(new Definition(Workflow\Transition::class, array($transitionName, $transition['from'], $transition['to']))));
$transitions[] = new Definition(Workflow\Transition::class, array($transitionName, $transition['from'], $transition['to']));
} elseif ($type === 'state_machine') {
foreach ($transition['from'] as $from) {
foreach ($transition['to'] as $to) {
$definitionBuilderDefinition->addMethodCall('addTransition', array(new Definition(Workflow\Transition::class, array($transitionName, $from, $to))));
$transitions[] = new Definition(Workflow\Transition::class, array($transitionName, $from, $to));
}
}
}
@@ -424,7 +422,8 @@ private function registerWorkflowConfiguration(array $workflows, ContainerBuilde
// Create a Definition
$definitionDefinition = new Definition(Workflow\Definition::class);
$definitionDefinition->setPublic(false);
$definitionDefinition->setFactory(array($definitionBuilderDefinition, 'build'));
$definitionDefinition->addArgument($workflow['places']);
$definitionDefinition->addArgument($transitions);
$definitionDefinition->addTag('workflow.definition', array(
'name' => $name,
'type' => $type,

0 comments on commit e269ca5

Please sign in to comment.
You can’t perform that action at this time.