mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
BackedEnum primary key fails to convert for association using proxy classes #7171
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 @wmouwen on GitHub (Jun 22, 2023).
Bug Report
Summary
For a while BackedEnums were allowed as primary keys, where Doctrine would happily convert them to their scalar value. There has been some back and forth about this in previous issues/PRs where the functionality was repaired and broken again.
https://github.com/doctrine/orm/issues/10334
https://github.com/doctrine/orm/issues/10471
https://github.com/doctrine/orm/pull/10508
Most recent events:
https://github.com/doctrine/orm/issues/10745
https://github.com/doctrine/orm/pull/10758
Current behavior
Setting a BackedEnum as primary key on an entity, using that entity in an association and trying to save it with a proxy class, will throw an error as the BackedEnum is no longer converted to a scalar value.
How to reproduce
See https://github.com/wmouwen/doctrine-orm-10788 for a minimal setup throwing the error.
Code snippet copy 👇
Expected behavior
The BackedEnum is converted and the save succeeds, as it did in version
2.15.2.-edit- Added the stack trace, made the code snippet collapse, added reference to repository with minimal setup.