mapper-php icon indicating copy to clipboard operation
mapper-php copied to clipboard

Option to map data into collection instead of arrays.

Open NicklasWallgren opened this issue 8 years ago • 2 comments

It would have been nice to have an option to map data into collections, for example ArrayObject, instead of arrays.

I propose a new annotation;

@destination ArrayObject

NicklasWallgren avatar May 06 '17 15:05 NicklasWallgren

So, the @destination annotation would pass the value to the constructor of the class given? In this example, the value of the mapped property will be new ArrayObject($value) ?

runz0rd avatar May 07 '17 13:05 runz0rd

Exactly, the value would be passed to the constructor.

Additional improvements;

  1. Use doctrine annotation to improve performance
  2. Support aliases and use statement, so we don't need to state the full namespace of the subject. Example (https://gist.github.com/Zeronights/7b7d90fcf8d4daf9db0c)

NicklasWallgren avatar May 21 '17 13:05 NicklasWallgren