mark-gerarts / automapper-plus

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

Add MapperAware functionality to customAutomapper classes #19

Closed vasilake-v closed 6 years ago

vasilake-v commented 6 years ago

Add MapperAwareOperation interface handling for CustomAutomapper classes

I assume the MapperAwareOperation interface could be moved up a level and renamed accordingly because it's not related only to mapping operations. But I wait for your suggestions and comments

mark-gerarts commented 6 years ago

Hi again @slava-v; good suggestion! I agree with your remark as well. Naming the interface MapperAwareOperation is a bit too specific and can be generalized.

I suggest we implement it like this:

interface MapperAware
{
    public function setMapper(AutoMapperInterface $mapper): void;
}

We can then keep the MapperAwareOpration interface, but make it extend the new one. This way we preserve backwards compatibility. The new interface should also be moved to a more general namespace, maybe just the root one.

What do you think? If we're gonna implement it this way, are you gonna do this, or do you want me to? Either way, this PR is a good idea and I'll merge it once it is finished.

Thanks!

vasilake-v commented 6 years ago

Hi @mark-gerarts , thanks for comments ! :)

I have made the changes.

mark-gerarts commented 6 years ago

Looking good, it's merged. Thanks for the contribution!