kondor
kondor

Reputation: 863

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 ...

Upvotes: 10

Views: 4667

Answers (2)

Rostyslav Pylypenko
Rostyslav Pylypenko

Reputation: 376

php bin/console debug:container --tag=doctrine.event_subscriber

OR

php bin/console debug:container --tag=doctrine.orm.entity_listener

Upvotes: 1

Max P.
Max P.

Reputation: 5679

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.

Upvotes: 11

Related Questions