-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Error in ProxyFactory using cloned proxy entity with Enum field #11386
Comments
Are you using https://github.com/doctrine/persistence/releases/tag/3.3.2 ? |
|
Please update. |
Update to 3.3.2 does not help, error remains |
Because bug in ProxyFactory, not in Persistence package |
Oh right, I read too fast, and I think your fix is correct 🤔 , in fact I'm a bit surprised I didn't contribute it after contributing doctrine/persistence#348 (which was already in 3.3.1) |
I see you're using 3.1.0, maybe this is just a matter of merging up and releasing a new version, let me check. |
Nope, it's not contributed to 2.x yet. Please send a PR 🙏 |
I think this only affects 3.1.x, because this is the branch where I contributed #11330 |
Made a PR |
Bug Report
Summary
I'll use simulated example. We have 2 entities (Cart, Customer) with OneToOne join. Customer entity has PHP Enum field. I fetch Cart from database, get Customer (receive proxy object), make copy with clone. When I try to access data of cloned entity - there is fatal error:
Typed property ReflectionProperty::$name must not be accessed before initialization
in Doctrine\ORM\Proxy\ProxyFactory line 237.In that cycle $property is a Doctrine\Persistence\Reflection\EnumReflectionProperty object and $name variable is not initialized.
EnumReflectionProperty has method getName() - using this method in ProxyFactory solves the problem.
Possible fix:
Current behavior
Fatal error
How to reproduce
2 entities, enum object and example to reproduce:
Expected behavior
No errors
The text was updated successfully, but these errors were encountered: