mark-gerarts / automapper-plus

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

How to handle support for mapping to stdClass #3

Closed djmattyg007 closed 6 years ago

djmattyg007 commented 7 years ago

PHPStan has configuration for something it calls "object crates". These are classes that are like stdClass, that just accept whatever you read and write to them by way of get() and set().

I'd lile to suggest that the best way to support mapping to stdClass would be a generic system such as this, where you configure a destination class as an object crate, and everything is just written as-is. This makes it easy to extend when integrating it into frameworks and other dynamic code.

mark-gerarts commented 7 years ago

I'll definitely look into this, and how it's implemented in PHPStan. Thanks for the suggestion!

smoelker commented 6 years ago

Any progress on adding this feature?

mark-gerarts commented 6 years ago

I haven't started on this yet, as it looks it might take some time to do it right. I'll look into it come next week, since I'm a bit busy this week (holidays).

mark-gerarts commented 6 years ago

This is available as of release 1.1.0. I'm closing this, but feel free to reopen / create a new isue if you encounter problems :)