File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -451,6 +451,24 @@ HTTP status to return if the validation fails::
451451
452452The default status code returned if the validation fails is 404.
453453
454+ If the request query string is empty and if you still need to have a valid DTO, you can
455+ define a default value in your controller method::
456+
457+ use App\Model\UserDto;
458+ use Symfony\Component\HttpFoundation\Response;
459+ use Symfony\Component\HttpKernel\Attribute\MapQueryString;
460+
461+ // ...
462+
463+ public function dashboard(
464+ #[MapQueryString] UserDTO $userDto = new UserDTO()
465+ ): Response
466+ {
467+ // ...
468+ }
469+
470+ In this case your DTO should have default values.
471+
454472.. versionadded :: 6.3
455473
456474 The :class: `Symfony\\ Component\\ HttpKernel\\ Attribute\\ MapQueryString ` attribute
You can’t perform that action at this time.
0 commit comments