Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
Open
Labels
Description
Description
Nested mapping is currently only supported for a single object.
Theres currently no way without implementing it yourself using reflection to map array of objects to an array of targets.
Example
// Test source objectclass Book {/** * @var Page[] */protectedarray$pages;}// Test dto#[Map(source: Book::class)]class BookDto {/** * @var PageDto[] */ #[Map(source:"pages")]publicarray$pages;}// Mapping Book to BookDto$book =newBook();$dto =$mapper->map($book, BookDto::class);var_dump($dto->pages);// Page[]