mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Error in ProxyFactory using cloned proxy entity with Enum field #7350
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @valkars on GitHub (Mar 20, 2024).
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 initializationin 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
@greg0ire commented on GitHub (Mar 20, 2024):
Are you using https://github.com/doctrine/persistence/releases/tag/3.3.2 ?
@valkars commented on GitHub (Mar 20, 2024):
@greg0ire commented on GitHub (Mar 20, 2024):
Please update.
@valkars commented on GitHub (Mar 20, 2024):
Update to 3.3.2 does not help, error remains
@valkars commented on GitHub (Mar 20, 2024):
Because bug in ProxyFactory, not in Persistence package
@greg0ire commented on GitHub (Mar 20, 2024):
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 https://github.com/doctrine/persistence/pull/348 (which was already in 3.3.1)
@greg0ire commented on GitHub (Mar 20, 2024):
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.
@greg0ire commented on GitHub (Mar 20, 2024):
Nope, it's not contributed to 2.x yet. Please send a PR 🙏
@greg0ire commented on GitHub (Mar 20, 2024):
I think this only affects 3.1.x, because this is the branch where I contributed https://github.com/doctrine/orm/pull/11330
@valkars commented on GitHub (Mar 20, 2024):
Made a PR
@vytsci commented on GitHub (Mar 4, 2025):
Updated doctrine/persistence to 3.4.0; still, the error persists.