Skip to content

[DoctrineBridge] add generic service to reset object managers #46266

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

Closed
wants to merge 1 commit into from

Conversation

kbond
Copy link
Member

@kbond kbond commented May 5, 2022

Q A
Branch? 6.1 (6.2)
Bug fix? no
New feature? yes
Deprecations? yes
Tickets n/a
License MIT
Doc PR n/a

I might be off-base here but shouldn't the object manager's be reset between requests? Now that messenger supports resetting services, this could replace the DoctrineClearEntityManagerWorkerSubscriber.

Ran into an issue (zenstruck/messenger-test#43) where the em is cleared when processing messenger messages in tests. This was not desired and there is no way to disable. Another solution would be to make DoctrineClearEntityManagerWorkerSubscriber configurable in doctrine-bundle (doctrine/DoctrineBundle#1043).

I wanted to first check if there should be a more generic resetter.

TODO:

  • update changelog
  • deprecate DoctrineClearEntityManagerWorkerSubscriber?
  • add doctrine-bundle PR

@carsonbot carsonbot added Status: Needs Review Deprecation DoctrineBridge Feature RFC RFC = Request For Comments (proposals about features that you want to be discussed) labels May 5, 2022
@carsonbot carsonbot added this to the 6.1 milestone May 5, 2022
@carsonbot carsonbot changed the title [RFC][DoctrineBridge] add generic service to reset object managers [DoctrineBridge] add generic service to reset object managers May 5, 2022
@kbond kbond force-pushed the reset-em-service branch from afa9426 to 18ec20a Compare May 5, 2022 14:40
@chalasr chalasr modified the milestones: 6.1, 6.2 May 8, 2022
@nicolas-grekas
Copy link
Member

nicolas-grekas commented Jul 28, 2022

I'm not sure about this. The purpose of an ORM is also to deal with state-(re)synchronization on long running processes. Doing this by default would just break this. It's fine to me if the reset is opt-in.

@kbond
Copy link
Member Author

kbond commented Aug 10, 2022

Fair enough, let's close.

@kbond kbond closed this Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecation DoctrineBridge Feature RFC RFC = Request For Comments (proposals about features that you want to be discussed) Status: Needs Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants