automapper-plus
                                
                                
                                
                                    automapper-plus copied to clipboard
                            
                            
                            
                        Allow context for map() with CustomMapper
Allow context as third argument CustomMapper->mapToObject($source, $destination, array $context = []). As result it works for mapToObject(), but not for map(). Propose: line https://github.com/mark-gerarts/automapper-plus/blob/master/src/AutoMapper.php#L92
return $this->getCustomMapper($mapping)->map($source, $destinationClass);
replace to
return $this->getCustomMapper($mapping)->map($source, $destinationClass, $context);
                                    
                                    
                                    
                                
Hi @pysarenkoa, this seems like a very reasonable thing to add. Do you want to open up a PR for this? Otherwise I'll look into adding this myself, let me know.
Hi @mark-gerarts, thanks for your quick response. It will great if you do this yourself.
This has been added in release 1.4.0. Keep in mind that the minimum PHP version has been bumped to 7.4 for this release, since 7.3 and below are EOL.
@mark-gerarts does ther any chance to add the feature to 1.3 ? Since my app are using 7.3 php version.
Hi @ahmed-bhs, I'm not really a fan of maintaining several branches. Is it an option that you depend on a specific commit of the library? If so I suggest you depend on ffdb7827e43035fd956dfac368c096276bf870d9, the commit that introduced this feature - but still before the 7.4 requirement. Something like this in composer:
{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/mark-gerarts/automapper-plus.git"
        }
    ],
    "require": {
        "mark-gerarts/automapper-plus": "dev-master#ffdb7827e43035fd956dfac368c096276bf870d9"
    }
}
Then, once you're ready to upgrade to 7.4+, you can swap back to the regular branch.