mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Calling method on null when non-backed Enums are used #7299
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 @thePanz on GitHub (Jan 19, 2024).
Bug Report
Summary
When non-backed enums are used, an error occurs:
Call to a member function getName() on null.I know that only backed enums are supported, but guiding the developer to fix the issue in an error message should be implemented.
Current behavior
Running
bin/console doctrine:mapping:infothrowsHow to reproduce
Use the following classes. Notes:
Expected behavior
An error message about using a Backed enum should be reported for better DX
I would suggest some changes as to throw an exception in case the enum is not backed, stating which enum is used and in which class and property the error occurred.
Note: I would create a PR myself, but cloning the repo gives me a GIT error, sorry :(
@greg0ire commented on GitHub (Jan 19, 2024):
🤯
I don't reproduce this issue:
My output is slightly different, I'm getting one less object, and compressing more 🤔
040000maybe that's the zero-padded file mode? What version of git are you using?@thePanz commented on GitHub (Jan 19, 2024):
@greg0ire commented on GitHub (Jan 19, 2024):
Same version here, also on Linux so at least it's not that.
@greg0ire commented on GitHub (Jan 19, 2024):
@thePanz do you maybe have such settings set to
true: https://stackoverflow.com/q/41029654/353612 ?I managed to reproduce your issue with
@thePanz commented on GitHub (Mar 4, 2025):
Fixed in v2.17.4