Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[EventDispatcher] Access listener's priority. #11263

Copy link
Copy link
Closed
@ManInTheBox

Description

@ManInTheBox
Issue body actions

I believe currently there is no way (or at least easy way) to access event's priority. Priority is set only when registering all listeners and developer is not able to retrieve that value by simply calling for example $event->getPriority().

I noticed this while trying to expose event's priority to profilers' "events" panel. I wanted to add one more column in order to easily see event's priority passed to listed listeners. Moreover I wanted to add sorting ability to that rightmost column so I can easily sort called listeners in reverse order.

Currently if you want to see event's priority you need to:
a) If listener is "a subscriber" you just need to look at your implementation of EventSubscriber:: getSubscribedEvents() and priority will be there (or 0 if omitted) <- easier way
b) If listener is just simple service tagged by kernel.event_listener then you need to search for its service definition and then you need to look for priority attribute (or 0 if omitted) <- harder way

I'm still not sure if this was intentional by design or could be improved. Also I think this issue can be tagged with DX label since it can improve how developer see registered listeners on profiler's "events" panel. Sometimes it is crucial to have control over event's priorities. Especially if your listener overlaps with some other listener. /cc @javiereguiluz

Metadata

Metadata

Assignees

No one assigned

    Labels

    DXDX = Developer eXperience (anything that improves the experience of using Symfony)DX = Developer eXperience (anything that improves the experience of using Symfony)EventDispatcher

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.