Skip to content

fix mapping array of enums to setter which expects array of enums #280

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MrMeshok
Copy link
Contributor

@MrMeshok MrMeshok commented Jun 4, 2025

Fix #269
I found out that this bug was introduced in #230, to be more precise this lines ArrayTransformerFactory.
Before #230 $targetCollections would be equal [] so we would get return new DictionaryTransformer(new CopyTransformer());. And CopyTransformer would just pass enums from property to setPaymentMethods().
But simply removing this lines wouldn't work because they do serve they purpose in fixing weird behavior in #230.

So I dug further and found out original issue.
Here WriteMutator should get that setPaymentMethods() expects PaymentMethod[] but gets blocked here GetTypeTrait because argument $property equals 'setPaymentMethods' and we get this check that result in false and we skip trying to extract types

'$paymentMethods' !== '$setPaymentMethods'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enums mapping is not working correctly
1 participant