Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 :

AppBundle\EventListener\LivreSubscriber:
    tags:
        - { 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 ...

like image 802
kondor Avatar asked Jul 27 '17 14:07

kondor


1 Answers

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.

like image 198
Max P. Avatar answered Oct 03 '22 19:10

Max P.