@@ -1109,6 +1109,29 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $
1109
1109
$ container ->setParameter ('workflow.has_guard_listeners ' , true );
1110
1110
}
1111
1111
}
1112
+
1113
+ $ listenerAttributes = [
1114
+ Workflow \Attribute \AsAnnounceListener::class,
1115
+ Workflow \Attribute \AsCompletedListener::class,
1116
+ Workflow \Attribute \AsEnterListener::class,
1117
+ Workflow \Attribute \AsEnteredListener::class,
1118
+ Workflow \Attribute \AsGuardListener::class,
1119
+ Workflow \Attribute \AsLeaveListener::class,
1120
+ Workflow \Attribute \AsTransitionListener::class,
1121
+ ];
1122
+
1123
+ foreach ($ listenerAttributes as $ attribute ) {
1124
+ $ container ->registerAttributeForAutoconfiguration ($ attribute , static function (ChildDefinition $ definition , AsEventListener $ attribute , \ReflectionClass |\ReflectionMethod $ reflector ) {
1125
+ $ tagAttributes = get_object_vars ($ attribute );
1126
+ if ($ reflector instanceof \ReflectionMethod) {
1127
+ if (isset ($ tagAttributes ['method ' ])) {
1128
+ throw new LogicException (sprintf ('"%s" attribute cannot declare a method on "%s::%s()". ' , $ attribute ::class, $ reflector ->class , $ reflector ->name ));
1129
+ }
1130
+ $ tagAttributes ['method ' ] = $ reflector ->getName ();
1131
+ }
1132
+ $ definition ->addTag ('kernel.event_listener ' , $ tagAttributes );
1133
+ });
1134
+ }
1112
1135
}
1113
1136
1114
1137
private function registerDebugConfiguration (array $ config , ContainerBuilder $ container , PhpFileLoader $ loader ): void
0 commit comments