-
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
Enum field mapping validation #11037
Comments
Can you provide a reproducer or a failing test for your issue? If you've already found a solution (as you apparently did), don't hesitate to open a PR with your fix and a test that fails without your fix. |
Here we go #11039 |
I stumbled over this issue when using Seems like |
Having the same problem here when updating to |
I can confirm this issue. |
The recently properties types validation implemented in #10946 is not working properly for enum mappings:
orm/lib/Doctrine/ORM/Tools/SchemaValidator.php
Lines 384 to 387 in 16028e4
where
$propertyType
is a BackedEnum class and$metadataFieldType
isstring
orint
.Possible solution
I'd add another check (just below that block) to validate the enum mapping, something like this worked for me:
It checks the property type against the
enumType
instead, but also checks if the BackedEnum variant (string or int) matches the metadata field type.Does it make sense to you?
Affected versions:
2.17.x
+The text was updated successfully, but these errors were encountered: