File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -443,6 +443,27 @@ HTTP status to return if the validation fails::
443
443
444
444
The default status code returned if the validation fails is 404.
445
445
446
+ If you want to map your object to a nested array in your query with a specific key,
447
+ you can use the ``key `` option in your :class: `Symfony\\ Component\\ HttpKernel\\ Attribute\\ MapQueryString `
448
+ attribute::
449
+
450
+ use App\Model\SearchDto;
451
+ use Symfony\Component\HttpFoundation\Response;
452
+ use Symfony\Component\HttpKernel\Attribute\MapQueryString;
453
+
454
+ // ...
455
+
456
+ public function dashboard(
457
+ #[MapQueryString(key: 'search')] SearchDto $searchDto
458
+ ): Response
459
+ {
460
+ // ...
461
+ }
462
+
463
+ .. versionadded :: 7.3
464
+
465
+ The ``key `` option of ``#[MapQueryString] `` was introduced in Symfony 7.3.
466
+
446
467
If you need a valid DTO even when the request query string is empty, set a
447
468
default value for your controller arguments::
448
469
You can’t perform that action at this time.
0 commit comments