Skip to content

Commit e269ca5

Browse files
committed
minor symfony#20478 [Workflow] Removed definition builder (Nyholm)
This PR was squashed before being merged into the 3.2-dev branch (closes symfony#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 symfony#20451 (comment) We do not really need the definition builder here. Commits ------- caa3d6f [Workflow] Removed definition builder
2 parents f8fb91b + caa3d6f commit e269ca5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -406,16 +406,14 @@ private function registerWorkflowConfiguration(array $workflows, ContainerBuilde
406406
foreach ($workflows as $name => $workflow) {
407407
$type = $workflow['type'];
408408

409-
// Create a DefinitionBuilder
410-
$definitionBuilderDefinition = new Definition(Workflow\DefinitionBuilder::class);
411-
$definitionBuilderDefinition->addMethodCall('addPlaces', array($workflow['places']));
409+
$transitions = array();
412410
foreach ($workflow['transitions'] as $transitionName => $transition) {
413411
if ($type === 'workflow') {
414-
$definitionBuilderDefinition->addMethodCall('addTransition', array(new Definition(Workflow\Transition::class, array($transitionName, $transition['from'], $transition['to']))));
412+
$transitions[] = new Definition(Workflow\Transition::class, array($transitionName, $transition['from'], $transition['to']));
415413
} elseif ($type === 'state_machine') {
416414
foreach ($transition['from'] as $from) {
417415
foreach ($transition['to'] as $to) {
418-
$definitionBuilderDefinition->addMethodCall('addTransition', array(new Definition(Workflow\Transition::class, array($transitionName, $from, $to))));
416+
$transitions[] = new Definition(Workflow\Transition::class, array($transitionName, $from, $to));
419417
}
420418
}
421419
}
@@ -424,7 +422,8 @@ private function registerWorkflowConfiguration(array $workflows, ContainerBuilde
424422
// Create a Definition
425423
$definitionDefinition = new Definition(Workflow\Definition::class);
426424
$definitionDefinition->setPublic(false);
427-
$definitionDefinition->setFactory(array($definitionBuilderDefinition, 'build'));
425+
$definitionDefinition->addArgument($workflow['places']);
426+
$definitionDefinition->addArgument($transitions);
428427
$definitionDefinition->addTag('workflow.definition', array(
429428
'name' => $name,
430429
'type' => $type,

0 commit comments

Comments
 (0)