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 object
class Book {
/**
* @var Page[]
*/
protected array $pages;
}
// Test dto
#[Map(source: Book::class)]
class BookDto {
/**
* @var PageDto[]
*/
#[Map(source: "pages")]
public array $pages;
}
// Mapping Book to BookDto
$book = new Book();
$dto = $mapper->map($book, BookDto::class);
var_dump($dto->pages); // Page[]