Skip to content

Cannot map to a class that has adder and remover AND constructor arguments #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wuchen90 opened this issue Dec 6, 2024 · 0 comments · Fixed by #212
Closed

Cannot map to a class that has adder and remover AND constructor arguments #211

wuchen90 opened this issue Dec 6, 2024 · 0 comments · Fixed by #212

Comments

@wuchen90
Copy link
Contributor

wuchen90 commented Dec 6, 2024

When the target class has adder and remover for a property and if we have this said property as constructor arguments also, the mapper will break because the \AutoMapper\Transformer\AbstractArrayTransformer will check for adder and try to use it.

In case where the target is just a classname and not an instance, an error will be thrown.

Undefined variable $constructarg

I tried to fix it by my own but my knowledge is limited on this matter, so I just made a test to reproduce this issue: wuchen90#1

Korbeil added a commit that referenced this issue Jan 31, 2025
…ctor arguments (#212)

After some attempts, I came to this solution for this issue:
#211.

Not sure if it's the right thing to do.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant