@@ -406,16 +406,14 @@ private function registerWorkflowConfiguration(array $workflows, ContainerBuilde
406
406
foreach ($ workflows as $ name => $ workflow ) {
407
407
$ type = $ workflow ['type ' ];
408
408
409
- // Create a DefinitionBuilder
410
- $ definitionBuilderDefinition = new Definition (Workflow \DefinitionBuilder::class);
411
- $ definitionBuilderDefinition ->addMethodCall ('addPlaces ' , array ($ workflow ['places ' ]));
409
+ $ transitions = array ();
412
410
foreach ($ workflow ['transitions ' ] as $ transitionName => $ transition ) {
413
411
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 ' ]));
415
413
} elseif ($ type === 'state_machine ' ) {
416
414
foreach ($ transition ['from ' ] as $ from ) {
417
415
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 ));
419
417
}
420
418
}
421
419
}
@@ -424,7 +422,8 @@ private function registerWorkflowConfiguration(array $workflows, ContainerBuilde
424
422
// Create a Definition
425
423
$ definitionDefinition = new Definition (Workflow \Definition::class);
426
424
$ definitionDefinition ->setPublic (false );
427
- $ definitionDefinition ->setFactory (array ($ definitionBuilderDefinition , 'build ' ));
425
+ $ definitionDefinition ->addArgument ($ workflow ['places ' ]);
426
+ $ definitionDefinition ->addArgument ($ transitions );
428
427
$ definitionDefinition ->addTag ('workflow.definition ' , array (
429
428
'name ' => $ name ,
430
429
'type ' => $ type ,
0 commit comments