-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Yaml] Allow to get all the enum cases #52230
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
Conversation
456369a
to
041ab2c
Compare
Please provide a meaningful PR description that explains the feature you're adding, how to use it and what's your motivation behind it. This helps us deciding whether we want to add your feature to Symfony. In addition to that, it helps the documentation team who will probably want to document your feature and announce it in our blog. |
I've added an example with a use case. Please, let me know if more context is required. |
It is still possible to add a constant to an enum. |
Thank you @phansys. |
With this addition, the
!php/enum
syntax is allowed to expose an array with all the enum cases (the result fromUnitEnum::cases()
). This is useful for cases likechoices
option from theChoice
validation constraint:BEFORE:
AFTER:
Prior to the support for enumerations, this was allowed by array constants: