-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle][EventDispatcher] Add priorities to the debug:event-dispatcher command #14563
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
…dispatcher command
That's a really good thing ! (ping @matthieuauger) I will look at it tomorrow @Seldaek , thx |
👍 |
1 similar comment
👍 |
+-------+-------------------+ | ||
+-------+-------------------+----------+ | ||
| Order | Callable | Priority | | ||
+-------+-------------------+----------+ |
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.
We could just replace the "Order" column with priority don't you think ? The "Order" column was just there because it was impossible to get priorities in dispatcher !
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.
Yes I wasn't quite sure why the Order column was there, maybe for people who can't count :P If you'd like to send a PR to remove it from the TextDescriptor that sounds good to me.
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.
I prefer to keep both , the order is useful when events have the same priority.
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.
The command already list the events by order so the information is still available. But finally I think it's more developer friendly to keep it, you don't have to know how Symfony manage order internally 👍
👍 |
Thank you @Seldaek. |
…he debug:event-dispatcher command (Seldaek) This PR was merged into the 2.8 branch. Discussion ---------- [FrameworkBundle][EventDispatcher] Add priorities to the debug:event-dispatcher command | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | TODO I find it helps to figure out which priority is needed to override another event listener without digging in the sources. Commits ------- 952929c [FrameworkBundle][EventDispatcher] Add priorities to the debug:event-dispatcher command
{ | ||
if (true === $withPriorities) { | ||
return $eventName ? $this->listeners[$eventName] : array_filter($this->listeners); |
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.
this is broken when there is no listener for $eventName
…iority() (fabpot) This PR was merged into the 2.8 branch. Discussion ---------- [EventDispatcher] added EventDispatcher::getListenerPriority() | Q | A | ------------- | --- | Bug fix? | yes | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #14563, #15825 | License | MIT | Doc PR | n/a In #14563, we added a way to get the priorities of listeners, but as noted by @Tobion in #15825, the implementation is sub-optimal because of two main reasons: the change is not part of the interface but more importantly, the added boolean changes the return value of `getListeners()`. This PR reverts most of #14563 to add a `getListenerPriority()` method. This method is quite slow, but as it should only be used for debugging purposes (on the CLI or the WDT), I think it's not really a problem. In 3.0, this method should probably be added to `EventDispatcherInterface`. ping @Tobion Commits ------- 068e955 [EventDispatcher] added EventDispatcher::getListenerPriority()
I find it helps to figure out which priority is needed to override another event listener without digging in the sources.