-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Listener object (doctrine.orm.entity_listener tagged) have other copy of EntityManager (injected by autowiring) #28869
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
Comments
Can you create a small example application that allows to reproduce your issue? |
very simple. Based on symfony skeleton |
Hmm I think this case should result in a If you mark your |
Nope. You can see service.yaml (first post) Very simple. |
yes currently it does not throw any |
I think there is no 'Circular Reference'. Simple injection for listener as service. |
For me this is a circular reference.
Waiting for @nicolas-grekas to have a look and confirm |
In my case: I use service which use EntityManager. |
That's not correct. Your service is a bit special because its tagged as |
I've experienced the same issue using the factory method:
To solve this i had to switch to
Refer to: stackoverflow question |
I have the same issue. I have 2 services, each getting a different instance of the manager. (spl_object_hash different) Both are using simple constructor injection, autowired, and type hinted as Doctrine\ORM\EntityManagerInterface. These manager have different units of work, so have different managed entities. |
@ro0NL Thank you, this fixed my issue. The original problem in this issue seem a bit older, so it should be different as @nicolas-grekas pointed out in the PR. |
Hey, thanks for your report! |
Hey, thanks for your report! |
Hello? This issue is about to be closed if nobody replies. |
Friendly ping? Should this still be open? I will close if I don't hear anything. |
Hello. I have a problem with two diffents copy of em
service.yaml:
result:

why ?
for investigation I use:
composer create-project symfony/skeleton blog
The text was updated successfully, but these errors were encountered: