Skip to content

[HttpKernel] Enhance MapQueryString adding validation group #50082

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
Apr 21, 2023

Conversation

renanbr
Copy link

@renanbr renanbr commented Apr 20, 2023

Q A
Branch? 6.3
Bug fix? no
New feature? yes
Deprecations? no
Tickets continuity of #50029 and #49138
License MIT
Doc PR n/a
  • Introduces $validationGroups property to the MapQueryString attribute to work as same as in MapRequestPayload
  • Renames MapQueryString property $context to $serializationContext to harmonize with MapRequestPayload
# src/Controller/HelloController.php

namespace App\Controller;

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Attribute\AsController;
use Symfony\Component\HttpKernel\Attribute\MapQueryString;
use Symfony\Component\Routing\Annotation\Route;

#[AsController]
final class HelloController
{
    #[Route('/hello', methods: ['GET'])]
    public function __invoke(
        #[MapQueryString(validationGroups: 'strict')] MyObject $object,
    ): Response {
        // ...
    }
}

@renanbr renanbr force-pushed the map-query-string-enhanced branch from d29c28d to 8aad8b9 Compare April 20, 2023 17:22
@fabpot
Copy link
Member

fabpot commented Apr 21, 2023

Thank you @renanbr.

@fabpot fabpot merged commit eece9de into symfony:6.3 Apr 21, 2023
@renanbr renanbr deleted the map-query-string-enhanced branch April 21, 2023 06:48
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.

4 participants