File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Tests/DependencyInjection Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -463,8 +463,19 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode): void
463463 ->cannotBeEmpty ()
464464 ->end ()
465465 ->arrayNode ('initial_marking ' )
466- ->acceptAndWrap (['string ' ])
466+ ->acceptAndWrap (['backed-enum ' , ' string ' ])
467467 ->defaultValue ([])
468+ ->beforeNormalization ()
469+ ->ifArray ()
470+ ->then (static function ($ markings ) {
471+ $ normalizedMarkings = [];
472+ foreach ($ markings as $ marking ) {
473+ $ normalizedMarkings [] = $ marking instanceof \BackedEnum ? $ marking ->value : $ marking ;
474+ }
475+
476+ return $ normalizedMarkings ;
477+ })
478+ ->end ()
468479 ->prototype ('scalar ' )->end ()
469480 ->end ()
470481 ->arrayNode ('events_to_dispatch ' , 'event_to_dispatch ' )
Original file line number Diff line number Diff line change @@ -711,6 +711,7 @@ public function testWorkflowEnumArcsNormalization()
711711 'enum ' => [
712712 'supports ' => [self ::class],
713713 'places ' => Places::cases (),
714+ 'initial_marking ' => Places::A,
714715 'transitions ' => [
715716 [
716717 'name ' => 'one ' ,
@@ -728,6 +729,8 @@ public function testWorkflowEnumArcsNormalization()
728729 ],
729730 ]]);
730731
732+ $ this ->assertSame (['a ' ], $ config ['workflows ' ]['workflows ' ]['enum ' ]['initial_marking ' ]);
733+
731734 $ transitions = $ config ['workflows ' ]['workflows ' ]['enum ' ]['transitions ' ];
732735
733736 $ this ->assertSame ('one ' , $ transitions [0 ]['name ' ]);
You can’t perform that action at this time.
0 commit comments