-
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
BC Break for findBy with custom enum types #10432
Comments
The question here is, do we want to fix this behavior. The only way would be to check first whether this is an enum using Alternatively we may just ignore this issue and say, that if working with custom DBAL types that use enum as the PHP value representation, you have to count with the possibility of receiving the actual value, not an enum instance, into your Either way, this was a BC break and it was not documented |
This seems a bit harder than I thought, as Maybe we should revert the #9453 changes, and instead do the conversion of enum to its value inside |
I hit this same bug and changed convertToDatabaseValue to accept string|int also. |
Occurred at my project as well. Also voting it should be changed so |
Why do you have custom enum types if i may ask |
Well for me specifically its the ability to use native SQL I have made my own types also with support of https://github.com/Elao/PhpEnums and it allows me great flexibility together with PHP enum attributes. |
Hard to recall after that long time. 2 lines of code from Doctrine Entity class:
I know there was also a reason for custom types as adapting some enum libraries to Doctrine required that. I think many projects will have mix of some enum library and PHP enums together and to simplify keep code style with/to Doctrine same. That means to keep enums as custom types even they are now real PHP enums. |
My case is the same as @michnovka's. I wanted to have |
BC Break Report
Summary
This commit #9453 allows to use enums in
findBy
. However it breaks behavior when custom DBAL types use enums as their PHP values (can be seen here: Elao/PhpEnums#199 )Previous behavior
Previously
findBy()
call for a custom DBAL type field which uses enum as values would call itsconvertToDatabaseValue
with an enum instance.Current behavior
After this commit, the
convertToDatabaseValue
receives thestring
orint
(the actual value of theBackedEnum
).The text was updated successfully, but these errors were encountered: