Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Which tag is correct doctrine.entity_listener or doctrine.orm.entity_listener #650

Closed
mmucklo opened this issue Apr 19, 2017 · 3 comments
Closed
Assignees

Comments

@mmucklo
Copy link

mmucklo commented Apr 19, 2017

When tagging service to be a listener your online docs on symfony.com say to tag it "doctrine.entity_listener".

However the code seems to search for doctrine.orm.entity_listener.

Which is correct?

DependencyInjection/Compiler/EntityListenerPass.php:

        $resolvers = $container->findTaggedServiceIds('doctrine.orm.entity_listener');
@mmucklo
Copy link
Author

mmucklo commented Apr 19, 2017

So there seems to be two pieces of documentation on symfony.com:

http://symfony.com/doc/current/doctrine/event_listeners_subscribers.html
http://symfony.com/doc/current/bundles/DoctrineBundle/entity-listeners.html

Which one is the correct one to follow?

@stof
Copy link
Member

stof commented May 3, 2017

There are 2 different tags:

  • doctrine.event_listener (and its sibling doctrine.event_subscriber) to register an event listener in the EventManager
  • doctrine.orm.entity_listener to register an EntityListener (which will be called only when the event concerns the entity for which it is attached).

Both tags are valid. They refer to different features (the EntityListener feature internally registers an event listener btw).

AFAIK, there is no documentation talking about doctrine.entity_listener. If there is one, it is a typo.

@kimhemsoe
Copy link
Member

Closing this one in favor of #457

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants