helmis.m
helmis.m

Reputation: 244

In which order service listener methods are called when the "kernel.request" event is fired?

If I have 2 services like ServiceName1 and ServiceName2 with tag:'kernel.event_listener' and event: kernel.request' in Symfony, in which order will that service methods be called when the kernel.request event is fired and priority not set for these services?

Upvotes: 2

Views: 1184

Answers (2)

gp_sflover
gp_sflover

Reputation: 3500

The order in which the listeners are called should follow the same order as they are written in the service file, like service.yml for example, or the order in which the service files were loaded (if these services they were not written in the same file).

You should see the same order looking at the "Events" panel of the Symfony profiler, under the "Called Listeners" tab, that includes a list of registered event listeners with their priority.

Upvotes: 1

craigh
craigh

Reputation: 2291

For Symfony <3.0 from your command line type

php app/console debug:event-dispatcher kernel.request

for Symfony >3.0 use

php bin/console debug:event-dispatcher kernel.request

and it will display a list of registered event listeners and the priority they will fire in.

Upvotes: 0

Related Questions