Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
456369a to041ab2cCompareUh oh!
There was an error while loading.Please reload this page.
derrabus commentedOct 22, 2023
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. |
phansys commentedOct 22, 2023
I've added an example with a use case. Please, let me know if more context is required. |
GromNaN commentedOct 23, 2023
It is still possible toadd a constant to an enum. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
fabpot commentedFeb 3, 2024
Thank you@phansys. |
Uh oh!
There was an error while loading.Please reload this page.
With this addition, the
!php/enumsyntax is allowed to expose an array with all the enum cases (the result fromUnitEnum::cases()). This is useful for cases likechoicesoption from theChoicevalidation constraint:BEFORE:
AFTER:
Prior to the support for enumerations, this was allowed by array constants: