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

Wrong proxy classes check in AbstractManagerRegistry if lazy ghost is enabled #1620

Closed
mba242 opened this issue Jan 18, 2023 · 3 comments · Fixed by #1621
Closed

Wrong proxy classes check in AbstractManagerRegistry if lazy ghost is enabled #1620

mba242 opened this issue Jan 18, 2023 · 3 comments · Fixed by #1621
Labels
Milestone

Comments

@mba242
Copy link

mba242 commented Jan 18, 2023

doctrine/orm creates proxy class implementations of various interfaces depending on whether the lazy ghost setting is enabled or not.
ProxyFactory line 116

doctrine/persistence checks a proxy class by its interface.
AbstractManagerRegistry line 176

doctrine/DoctrineBundle doesn't care and intializes doctrine/persistence with the old Proxy interface.
Registry line 30

Doctrine\Persistence\AbstractManagerRegistry->getManagerForClass($proxyClassName) returns null when lazy ghost is enabled.

@burned42
Copy link

I was just faced with the same issue after updating the flex recipe which enabled the lazy ghost objects.

And I can also confirm your findings, changing to the used proxy class name to Doctrine\Persistence\Proxy at https://github.com/doctrine/DoctrineBundle/blob/2.8.x/Registry.php#L30 seemed to work for me, though I'm not sure if that's a proper fix or if it would break other things.

A quick fix for me was to disable enable_lazy_ghost_objects again for now.

@mba242
Copy link
Author

mba242 commented Jan 18, 2023

[...]changing to the used proxy class name to Doctrine\Persistence\Proxy at https://github.com/doctrine/DoctrineBundle/blob/2.8.x/Registry.php#L30 seemed to work for me, though I'm not sure if that's a proper fix or if it would break other things.

I guess it will breaks something in case lazy ghost is disabled. In think it needs the same check like in the ProxyFactory class and give depending interface name to parent.

Anyway - there is a lot around in doctrine universe. I don't know if there more effects.

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Jan 18, 2023

Changing the namespace looks enough to me. PR sent as #1621

@ostrolucky ostrolucky added the Bug label Jan 18, 2023
@ostrolucky ostrolucky added this to the 2.8.3 milestone Jan 18, 2023
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 a pull request may close this issue.

4 participants