Closed Norbytus closed 1 month ago
I'm not sure what you have in mind. Can you explain that in the form of a code sample?
Like this https://automapper.jolicode.com/latest/getting-started/context/?h=const#constructor-arguments
class UserDto {
public function __construct(private string $name, private \DateTime $createdAt) {}
}
$source = new User();
$source->name = 'Jane';
$target = $autoMapper->map($source, UserDTO::class, [
'constructor_arguments' => [
UserDTO::class => ['createdAt' => new \DateTime('2021-01-01')]
]
]);
It is done in the linked PR, and in v1.11.0. Documentation: https://rekalogika.dev/mapper/object/extra-target-values
Thanks
In https://github.com/mark-gerarts/automapper-plus and https://github.com/jolicode/automapper you could put extract argument in construct? This impl have same function? In doc i see https://rekalogika.dev/mapper/preset but its complatecated understand how add one or more extra arguments