Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpKernel] [MapQueryString] added key argument to MapQueryString attribute #59157

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
merged 1 commit into from
Dec 10, 2024

Conversation

feymo
Copy link
Contributor

@feymo feymo commented Dec 10, 2024

Q A
Branch? 7.3
Bug fix? no
New feature? yes
Deprecations? no
Issues N/A
License MIT

When using [#MapQueryString], the default resolver uses the $request->query-all() function but there's currently no way to pass a specific key to this function if needed.
This PR add a $key argument to the #[MapQueryString] attribute that will allow to pass a specific key if needed to the default resolver.

Example :
Given the following query : https://example.org?search[term]=foo&search[category]=bar, using current #[MapQueryString] implementation will resolve an object with only $search property.
Change proposed in this PR allows to pass a key argument like #[MapQueryString(key: search)]. Doing so, the object will be resolved with $term and $category properties.

@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 7.3 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

@fabpot fabpot force-pushed the feat/add-key-config-map-query-string branch from 7fbdfca to ac1f54c Compare December 10, 2024 17:37
@fabpot
Copy link
Member

fabpot commented Dec 10, 2024

Thank you @feymo.

@fabpot fabpot merged commit bb8fc43 into symfony:7.3 Dec 10, 2024
7 of 10 checks passed
@feymo feymo deleted the feat/add-key-config-map-query-string branch December 10, 2024 22:06
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Dec 19, 2024
…n (feymo)

This PR was merged into the 7.3 branch.

Discussion
----------

[HttpKernel] [MapQueryString] Add docs for new key option

Will fix #20463

Add documentation for the new `key` option added to `MapQueryString` attribute added in symfony/symfony#59157

Commits
-------

2fdd0db docs(controller): add docs for key option in MapQueryString
@fabpot fabpot mentioned this pull request May 2, 2025
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.

6 participants