Description
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