@@ -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