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

Tag Doctrine's EntityManager with ResetInterface #34720

Closed
Aerendir opened this issue Nov 29, 2019 · 7 comments
Closed

Tag Doctrine's EntityManager with ResetInterface #34720

Aerendir opened this issue Nov 29, 2019 · 7 comments

Comments

@Aerendir
Copy link

@Aerendir Aerendir commented Nov 29, 2019

Description
Following this discussion on Twitter with @lyrixx and @nicolas-grekas , I'm opening this issue.

It seems that the Doctrine's EntityManagers are not tagged with the ResetInterface interface and so they are not reset when calling Application::reset() method.

Currently I've not verified on my own, but I trust what @lyrixx said in the Twitter 3d.

@xabbuh

This comment has been minimized.

Copy link
Member

@xabbuh xabbuh commented Nov 30, 2019

Can you open the issue in the DoctrineBundle repository? That's where the service for the entity manager is defined.

@nicolas-grekas

This comment has been minimized.

Copy link
Member

@nicolas-grekas nicolas-grekas commented Nov 30, 2019

Actually we do reset the entity managers, it's the job of ManagerRegistry, see https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Doctrine/ManagerRegistry.php

This works only when ocramius/proxy-manager is installed - for some reasons I don't recall - but they must be serious (please prove me wrong :) )

@Aerendir

This comment has been minimized.

Copy link
Author

@Aerendir Aerendir commented Nov 30, 2019

So, in the end, the answer is "Yes, the EntityManager is reset when calling Application::rest()"?

@nicolas-grekas

This comment has been minimized.

Copy link
Member

@nicolas-grekas nicolas-grekas commented Nov 30, 2019

It's a bit more subtle but yes, the answer is yes :)

@Aerendir

This comment has been minimized.

Copy link
Author

@Aerendir Aerendir commented Dec 1, 2019

What do you mean by “a bit more subtle”?🤔

@nicolas-grekas

This comment has been minimized.

Copy link
Member

@nicolas-grekas nicolas-grekas commented Dec 2, 2019

@Aerendir what I wrote above :)

This works only when ocramius/proxy-manager is installed

@nicolas-grekas

This comment has been minimized.

Copy link
Member

@nicolas-grekas nicolas-grekas commented Dec 2, 2019

On a closer look, while the code infrastructure is there, it looks like it's not wired by default.
I opened doctrine/DoctrineBundle#1083 as a follow up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.