Alternative way to define InheritanceMap
I am wondering if there can be an alternative way to define InheritanceMap? Cause current one expects me to set an attribute on the target abstract class. However, for certain architectures like Onion, Clean Architecture and other layered examples this can be a violation of responsibility, when your classes "know" about classes from higher layer. It happens on mapping from DTO to Entity object. For example:
use Rekalogika\Mapper\Attribute\InheritanceMap;
use Domain\ConcreteClassA;
use Domain\ConcreteClassB;
use Domain\ConcreteClassC;
use Presentation\RequestAObjDTO;
use Presentation\RequestBObjDTO;
use Presentation\RequestCObjDTO;
#[InheritanceMap([
RequestAObjDTO::class => ConcreteClassA::class,
RequestBObjDTO::class => ConcreteClassB::class,
RequestCObjDTO::class => ConcreteClassC::class,
])]
abstract class ConcreteClass
{
}
So in this case, to convert Presentation layer object into Domain layer object I have to define this mapping in the Domain layer. That means I will get an alert in architecture control tools like phparkitect/deptrac that my Domain layer has dependencies on Presentation layer.
I guess it would be nice to have a way to define this inheritance mapping on Presentation layer side, maybe it's possible to do this on the source class providing 2 attributes smth like SourceInheritanceMap and TargetInheritanceMap, depending if this class treats as a source or as a target? Or maybe pass it in Context for this specific mapping action. Just brainstorming 🤷♂️
P.S. Offtop, I see you've added support for ramsey/uuid - that's great, cause we are using it widely - can you pls create new release so we don't need to make "dev-master" dependency? 😉