File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -502,6 +502,26 @@ payload formats::
502
502
// ...
503
503
}
504
504
505
+ Make sure to install `phpstan/phpdoc-parser `_ and `phpdocumentor/type-resolver `_
506
+ if you want to map a nested array of specific DTOs::
507
+
508
+ public function dashboard(
509
+ #[MapRequestPayload()] EmployeesDTO $employeesDto
510
+ ): Response
511
+ {
512
+ // ...
513
+ }
514
+
515
+ final class EmployeesDTO
516
+ {
517
+ /**
518
+ * @param UserDTO[] $users
519
+ */
520
+ public function __construct(
521
+ public readonly array $users = []
522
+ ) {}
523
+ }
524
+
505
525
.. versionadded :: 6.3
506
526
507
527
The :class: `Symfony\\ Component\\ HttpKernel\\ Attribute\\ MapRequestPayload ` attribute
@@ -771,3 +791,5 @@ Learn more about Controllers
771
791
.. _`SAPI` : https://www.php.net/manual/en/function.php-sapi-name.php
772
792
.. _`FrankenPHP` : https://frankenphp.dev
773
793
.. _`Validate Filters` : https://www.php.net/manual/en/filter.filters.validate.php
794
+ .. _`phpstan/phpdoc-parser` : https://packagist.org/packages/phpstan/phpdoc-parser
795
+ .. _`phpdocumentor/type-resolver` : https://packagist.org/packages/phpdocumentor/type-resolver
You can’t perform that action at this time.
0 commit comments