Skip to content

Commit ed6c5a2

Browse files
[HttpKernel] Add customization options to #[MapQueryString] and #[MapRequestPayload]
1 parent d5ab738 commit ed6c5a2

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)