-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] Support backed enums in #[MapQueryParameter]
#51004
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
[HttpKernel] Support backed enums in #[MapQueryParameter]
#51004
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
7f2cc82
to
3a10b7f
Compare
4a5479e
to
8625bc4
Compare
f3c785d
to
d05390c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a few CS changes. LGTM. Thanks.
d05390c
to
a201df7
Compare
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/QueryParameterValueResolver.php
Show resolved
Hide resolved
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/QueryParameterValueResolver.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/QueryParameterValueResolver.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/QueryParameterValueResolver.php
Outdated
Show resolved
Hide resolved
a201df7
to
487f5f8
Compare
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/QueryParameterValueResolver.php
Show resolved
Hide resolved
#[MapQueryParameter]
Thank you @andersmateusz. |
I had two options to introduce this feature. Extending
QueryParameterValueResolver
or extendingBackedEnumValueResolver
. Both options have it's prons and cons. ExtendingQueryParameterValueResolver
is not consistent with DRY principle, but on the other hand does not mislead users about usage ofValueResolverInterface
(#[MapQueryParameter]
takesresolver
argument but onlyQueryParameterValueResolver
resolves value unless creating your own implementation of the interface). I have chosen to extendQueryParameterValueResolver
. I think in the future separation of concerns should be introduced (resolving query params, resolving attributes etc.). For example by typing resolvers with new interface and using intersection types.