-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[EventDispatcher][DX] Autoconfigure event listeners #30760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6ceaf42 to
788b744
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice move :)
src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
Show resolved
Hide resolved
src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
Show resolved
Hide resolved
src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
Outdated
Show resolved
Hide resolved
076e7e6 to
52e4d7b
Compare
src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
Outdated
Show resolved
Hide resolved
8564bc6 to
4c33f8a
Compare
src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
Outdated
Show resolved
Hide resolved
e504447 to
e96cd81
Compare
e96cd81 to
c5f84fc
Compare
db1e7e3 to
fa7a958
Compare
src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
Outdated
Show resolved
Hide resolved
src/Symfony/Contracts/EventDispatcher/EventListenerInterface.php
Outdated
Show resolved
Hide resolved
src/Symfony/Contracts/EventDispatcher/EventListenerInterface.php
Outdated
Show resolved
Hide resolved
d24ac02 to
6b7fc01
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with minor comment + small rebase needed
src/Symfony/Contracts/EventDispatcher/EventListenerInterface.php
Outdated
Show resolved
Hide resolved
src/Symfony/Contracts/EventDispatcher/EventListenerInterface.php
Outdated
Show resolved
Hide resolved
src/Symfony/Contracts/EventDispatcher/EventListenerInterface.php
Outdated
Show resolved
Hide resolved
6b7fc01 to
4c13714
Compare
|
Oh! When a class implements both |
|
I agree @nicolas-grekas |
|
Re-reading this PR, I think I'm 👎 adding it. It looks a solution to a problem that does not exist. Also, I'm not a big fan of using reflection in the Container. We are slowly adding more of this and I'm not comfortable with it. |
|
I'm on the same side as @fabpot - let's be light on reflection-enabled magic, the compiler should be able to do as little reflection as possible. |
|
Two more issues that make me think that this is not something we want in core: the priority is not configurable and it adds a new way to declare Listeners. |
Now that event's FQDN could be used a eventName, this PR adds an alternative to EventSubscriberInterface that uses method's typehint to guess the event to subscribe.
usage for developers:
That's is. No more services to configure nor
getSubscribedEventsto implement.This PR contains 2 parts:
kernel.event_listenerto automatically register available methods when the tag does not contains the requirednameattribute.EventListenerInterface(which is empty) that's just use to trigger theregisterForAutoconfiguration.Few questionable choices made on that PR.
kernel.event_listenerinstead of creating a new oneFixed 2 issues:
container.hot_pathwas harcoded in subscriber logic (instead of using the injected variable)