Skip to content

[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

Merged

Conversation

andersmateusz
Copy link
Contributor

Q A
Branch? 6.4
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #50910
License MIT
Doc PR I think documentation about MapQueryParameter is missing

I had two options to introduce this feature. Extending QueryParameterValueResolver or extending BackedEnumValueResolver. Both options have it's prons and cons. Extending QueryParameterValueResolver is not consistent with DRY principle, but on the other hand does not mislead users about usage of ValueResolverInterface (#[MapQueryParameter]takes resolver argument but only QueryParameterValueResolver resolves value unless creating your own implementation of the interface). I have chosen to extend QueryParameterValueResolver. 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.

@carsonbot
Copy link

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:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 6.4 branch.

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!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@andersmateusz andersmateusz force-pushed the feature/map-query-param-backed-enum branch from 7f2cc82 to 3a10b7f Compare July 17, 2023 19:26
@andersmateusz andersmateusz force-pushed the feature/map-query-param-backed-enum branch 5 times, most recently from 4a5479e to 8625bc4 Compare July 18, 2023 21:55
@nicolas-grekas nicolas-grekas force-pushed the feature/map-query-param-backed-enum branch 3 times, most recently from f3c785d to d05390c Compare July 20, 2023 08:39
Copy link
Member

@nicolas-grekas nicolas-grekas left a 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.

@OskarStark OskarStark changed the title [HttpKernel] Support backed enums in #[MapQueryParameter] [HttpKernel] Support backed enums in #[MapQueryParameter] Aug 2, 2023
@fabpot
Copy link
Member

fabpot commented Aug 3, 2023

Thank you @andersmateusz.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support backed enums in #[MapQueryParameter]
6 participants