We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6ffabcc + e9a379e commit 02a2e4dCopy full SHA for 02a2e4d
controller.rst
@@ -442,6 +442,22 @@ HTTP status to return if the validation fails::
442
443
The default status code returned if the validation fails is 404.
444
445
+If you need a valid DTO even when the request query string is empty, set a
446
+default value for your controller arguments::
447
+
448
+ use App\Model\UserDto;
449
+ use Symfony\Component\HttpFoundation\Response;
450
+ use Symfony\Component\HttpKernel\Attribute\MapQueryString;
451
452
+ // ...
453
454
+ public function dashboard(
455
+ #[MapQueryString] UserDTO $userDto = new UserDTO()
456
+ ): Response
457
+ {
458
459
+ }
460
461
.. _controller-mapping-request-payload:
462
463
Mapping Request Payload
0 commit comments