Skip to content

Commit 804f0da

Browse files
committed
minor #18344 [HttpKernel] Add customization options to #[MapQueryString] and #[MapRequestPayload] (alexandre-daubois)
This PR was merged into the 6.3 branch. Discussion ---------- [HttpKernel] Add customization options to `#[MapQueryString]` and `#[MapRequestPayload]` Resolves #18237 Resolves #18229 Commits ------- ed6c5a2 [HttpKernel] Add customization options to `#[MapQueryString]` and `#[MapRequestPayload]`
2 parents 1f2047f + ed6c5a2 commit 804f0da

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

controller.rst

+20
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,16 @@ attribute in your controller::
430430
// ...
431431
}
432432

433+
You can customize the validation groups used during the mapping thanks to the
434+
``validationGroups`` option::
435+
436+
public function dashboard(
437+
#[MapQueryString(validationGroups: ['strict', 'edit'])] UserDTO $userDto
438+
): Response
439+
{
440+
// ...
441+
}
442+
433443
.. versionadded:: 6.3
434444

435445
The :class:`Symfony\\Component\\HttpKernel\\Attribute\\MapQueryString` attribute
@@ -482,6 +492,16 @@ your DTO::
482492
// ...
483493
}
484494

495+
You can also customize the validation groups used as well as supported
496+
payload formats::
497+
498+
public function dashboard(
499+
#[MapRequestPayload(acceptFormat: 'json', validationGroups: ['strict', 'read'])] UserDTO $userDto
500+
): Response
501+
{
502+
// ...
503+
}
504+
485505
.. versionadded:: 6.3
486506

487507
The :class:`Symfony\\Component\\HttpKernel\\Attribute\\MapRequestPayload` attribute

0 commit comments

Comments
 (0)