Skip to content

Commit 45a09a8

Browse files
committed
bug symfony#45299 [DependencyInjection] Fix AsEventListener not working on decorators (LANGERGabrielle)
This PR was merged into the 5.4 branch. Discussion ---------- [DependencyInjection] Fix AsEventListener not working on decorators | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | When using the `AsEventListener` on a decorator, it is ignored instead of registering the decorator as an event listener. This is because autoconfigured tags are not applied to decorators since symfony#30417. `EventSubscriberInterface` works as expected since symfony#38999, when the `kernel.event_subscriber'` tag was added to a list of "behavior describing tags" which can be autoconfigured onto decorators. This PR adds `kernel.event_listener` to this default list of tags, making `AsEventListener` work as expected on decorators. Commits ------- 5fbb217 Added `kernel.event_listener` to the default list of behavior describing tags, fixing AsEventListener attribute not working on decorators.
2 parents 5cb5880 + 5fbb217 commit 45a09a8

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,7 @@ public function load(array $configs, ContainerBuilder $container)
637637
'container.service_locator',
638638
'container.service_subscriber',
639639
'kernel.event_subscriber',
640+
'kernel.event_listener',
640641
'kernel.locale_aware',
641642
'kernel.reset',
642643
]);

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1971,6 +1971,7 @@ public function testRegisterParameterCollectingBehaviorDescribingTags()
19711971
'container.service_locator',
19721972
'container.service_subscriber',
19731973
'kernel.event_subscriber',
1974+
'kernel.event_listener',
19741975
'kernel.locale_aware',
19751976
'kernel.reset',
19761977
], $container->getParameter('container.behavior_describing_tags'));

0 commit comments

Comments
 (0)