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

Unable to reset entity manager with doctrine_integration enabled #286

Open
Jontsa opened this issue Sep 23, 2017 · 1 comment
Open

Unable to reset entity manager with doctrine_integration enabled #286

Jontsa opened this issue Sep 23, 2017 · 1 comment

Comments

@Jontsa
Copy link

Jontsa commented Sep 23, 2017

Doctrine provides method to reset (create new instance of) entity manager. This is useful for example when entity manager has closed after failed transaction. Method is found Doctrine\Common\Persistence\AbstractManagerRegistry::resetManager(). Since doctrine/doctrine-bundle >= 1.6.4, the entity manager service is marked as lazy

But with JMSDiExtraBundle and doctrine_integration enabled, the entity manager is not reset and instead the old closed instance of entity manager is returned.

Downgrading to doctrine-bundle 1.6.3 fixes the issue.
Disabling JMSDiExtraBundle fixes the issue
Setting doctrine_integration: false fixes the issue

Tested using JMSDiExtraBundle 1.8.2, Symfony 3.3.9 and doctrine-bundle 1.6.8

@mrthehud
Copy link

mrthehud commented Oct 11, 2017

I've also just spent a while debugging this. Before I thought about disabling the integration, I found that if I set 'doctrine.orm.default_entity_manager.delegate' to null in the container, subsequent calls to doctrine->getManager() return a correctly reset EM within the JMS proxy.

If the delegate were to be reset along with the em, I think this problem would go away. Not sure that's the correct approach however.
Symfony\Bridge\Doctrine\ManagerRegistry

If only my googling had found this one 3 hours ago.

Doctrine Bundle: 1.6.4
JMS DI Extra Bundle: 1.8.2
Symfony 2.8.27

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

2 participants