File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -523,8 +523,29 @@ the validation fails as well as supported payload formats::
523
523
// ...
524
524
}
525
525
526
+
526
527
The default status code returned if the validation fails is 422.
527
528
529
+ Make sure to install `phpstan/phpdoc-parser `_ and `phpdocumentor/type-resolver `_
530
+ if you want to map a nested array of specific DTOs::
531
+
532
+ public function dashboard(
533
+ #[MapRequestPayload()] EmployeesDTO $employeesDto
534
+ ): Response
535
+ {
536
+ // ...
537
+ }
538
+
539
+ final class EmployeesDTO
540
+ {
541
+ /**
542
+ * @param UserDTO[] $users
543
+ */
544
+ public function __construct(
545
+ public readonly array $users = []
546
+ ) {}
547
+ }
548
+
528
549
.. versionadded :: 6.3
529
550
530
551
The :class: `Symfony\\ Component\\ HttpKernel\\ Attribute\\ MapRequestPayload ` attribute
@@ -798,3 +819,5 @@ Learn more about Controllers
798
819
.. _`SAPI` : https://www.php.net/manual/en/function.php-sapi-name.php
799
820
.. _`FrankenPHP` : https://frankenphp.dev
800
821
.. _`Validate Filters` : https://www.php.net/manual/en/filter.filters.validate.php
822
+ .. _`phpstan/phpdoc-parser` : https://packagist.org/packages/phpstan/phpdoc-parser
823
+ .. _`phpdocumentor/type-resolver` : https://packagist.org/packages/phpdocumentor/type-resolver
You can’t perform that action at this time.
0 commit comments