automapper-plus-bundle icon indicating copy to clipboard operation
automapper-plus-bundle copied to clipboard

Mapper order issue

Open fractalzombie opened this issue 1 year ago • 2 comments

I have mapper order issue: Снимок экрана 2023-08-23 в 16 40 24

If one of Mapper in order is higher and it extends (copyFrom) from one of lower it will throw exception that no registered mapper here. I think this is very urgent error.

fractalzombie avatar Aug 23 '23 13:08 fractalzombie

Hi @fractalzombie, can you provide a code sample for this issue? Or do you mean something like this:

$config->registerMapping(Employee::class, EmployeeListView::class)
    ->copyFrom(Employee::class, EmployeeDto::class);

$config->registerMapping(Employee::class, EmployeeDto::class)
    ->forMember('fullName', function (Employee $source) {
            return $source->getFirstName() . ' ' . $source->getLastName();
        });

mark-gerarts avatar Dec 02 '23 15:12 mark-gerarts

For now no, because i alredy don't use this library, i gone from this company, but the issue only in loads, if registered map in alphabetically loads after all is ok, but if inverted it will fail, because no registered map will found.

fractalzombie avatar Dec 29 '23 16:12 fractalzombie