You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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[]