mark-gerarts/automapper-plus

Copy values rather than create a new instance?

tommyiraone opened this issue · 2 comments

How do I copy values from a source object to an existing destination object rather than create a new one?

maybe like..
$mapper->map($sourceObject, $destinationObject) ??

Hi @tommyiraone. Which version are you using? In 1.x you can do the following:

$mapper->mapToObject($sourceObject, $destinationObject);

In 2.x (beta) this is part of the map function, meaning your example would work.

I'm using 1.x
sorry for that, I think I have missed that one.

Thank you.