kondor kondor - 2 years ago 180
PHP Question

Symfony Doctrine event subscriber not listed in debug:event-dispatcher

Symfony v3.3.4, Doctrine ORM v2.5.6

I've created an event subscriber for a doctrine entity :

- { name: doctrine.event_subscriber }

It works fine ! But for a long time I tought it didn't work because the listener is not listed in the debug:event-dispatcher command :

$ docker-compose exec phpapp bin/console debug:event-dispatcher doctrine.event_subscriber

[WARNING] The event "doctrine.event_subscriber" does not have any registered listeners.

It's the same for an event listener.
And also : neither the Listener nor the Subscriber is listed in the symfony profiler (Event section) ...
So it works but it's strange that the listeners are not listed in the debug tool, isn't it ?

Can you tell me if you have the same behaviour with your projects ...

Answer Source

This subscriber is doctrine subscriber, not symfony. Doctrine uses its own event manager that is not connected with symfony event dispatcher. console debug:event-dispatcher lists only subscribers that are registered in symfony event dispatcher.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download