mark-gerarts / automapper-plus

An AutoMapper for PHP
MIT License
551 stars 30 forks source link

Map object to array? #37

Closed VitaliiIsaenko closed 5 years ago

VitaliiIsaenko commented 5 years ago

There is often a need to transform an object to associative array and I haven't found any good solutions for this. Even having some libraries they change a standard way to do such manipulations it in the project as we use the automapper-plus ;)
I've read somewhere that there is a plan to implement such a feature but in the next version because it has some breaking changes. Is it correct?
Anyway, I just wanted to ask whether this is a coming-soon feature and I can live with my hacks for now or should I better get some additional library for this only feature?
Kinds regards and thanks for the awesome library!

mark-gerarts commented 5 years ago

Well, are you willing to use this library on an unstable/dev branch? If so, I'll spend some time next weekend to set up a new branch and tag it as 2.0.0-alpha1 (or something similar). I'll implement the mapping to array on this branch, so you could use it already.

VitaliiIsaenko commented 5 years ago

That would be perfect! Would work for me. Thank you a lot!

mark-gerarts commented 5 years ago

I've just tagged a 2.0.0-alpha1 version where it is possible to map to an array. I've taken the opportunity to make some other BC-incompatible changes as well. You can find an overview of the changes here.

Please let me know if you encounter any problems!

VitaliiIsaenko commented 5 years ago

Nice, will try it today! Thank you so much!