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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resetting non-lazy managers #1108

Merged
merged 1 commit into from
Dec 19, 2019

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Dec 19, 2019

See #1106 (comment).

This refines the logic for resetting managers on kernel.reset:

  • Lazy managers will be reset through resetManager
  • Non-lazy managers will be cleared using EntityManager::clear
  • Uninitialised managers will be ignored

Also adds tests for all use-cases.

@ro0NL can you give this a test and see if it works? As much as I love releasing with our new tools, I'm afraid I'll run out of release numbers by the time this is fixed 馃槀

@alcaeus alcaeus added the Bug label Dec 19, 2019
@alcaeus alcaeus added this to the 1.12.6 milestone Dec 19, 2019
@alcaeus alcaeus self-assigned this Dec 19, 2019
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one thing and good to me.


private function resetOrClearManager(string $managerName, string $serviceId) : void
{
if (! $this->container->initialized($serviceId)) {
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method is not in the interface so it needs an extra check before calling it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type hint for the $container property in ManagerRegistry specifies this as a Container, not ContainerInterface. Similarly, the resetService method there doesn't check for this either. We should either fix the type hint and calls in ManagerRegistry, or restrict the constructor type hint in Registry to no longer accept any ContainerInterface.

Given the BC implications of changing the constructor signature in the bundle, I'd rather fix this in the bridge. I can create the PR if you agree.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok thanks for double checking. No need for more on my side.

Copy link

@ro0NL ro0NL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applied patch works 馃憤 we never faced any issues in web :)

thanks @alcaeus

@alcaeus alcaeus merged commit 08f9447 into doctrine:1.12.x Dec 19, 2019
@alcaeus alcaeus deleted the fix-resetting-nonlazy-managers branch December 19, 2019 09:08
@alcaeus
Copy link
Member Author

alcaeus commented Dec 19, 2019

Release will happen later today. I'll let some folks test this before doing it 馃槈

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

Successfully merging this pull request may close these issues.

None yet

3 participants