Skip to content

fix(AutoMapper): MapToContext should accept virtual properties #741

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

Merged
merged 1 commit into from
Aug 4, 2023

Conversation

nikophil
Copy link
Contributor

@nikophil nikophil commented Jul 10, 2023

I'm just not really sure about the strategy I used to make the service MapToContextPropertyInfoExtractorDecorator available: I don't want to decorate ReflectionExtractor in the whole app, this is a little bit too intrusive

Another solution would be to declare a new property extractor service specific to the automapper.

@nikophil nikophil force-pushed the fix/map-to-context-virtual-property branch 2 times, most recently from 107769d to 1a0e49c Compare July 10, 2023 10:07
@@ -65,4 +77,21 @@ private function allParametersHaveMapToContextAttribute(\ReflectionMethod $metho

return true;
}

private function isAllowedProperty(string $class, string $property, bool $writeAccessRequired = false): bool
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stolen directly in ReflectionExtractor

@nikophil nikophil force-pushed the fix/map-to-context-virtual-property branch 4 times, most recently from 1fada0a to 5123f97 Compare July 10, 2023 12:53
@nikophil nikophil force-pushed the fix/map-to-context-virtual-property branch from 5123f97 to 8ec10b0 Compare July 10, 2023 12:54
Copy link
Member

@Korbeil Korbeil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this

@Korbeil Korbeil merged commit 387e24f into janephp:next Aug 4, 2023
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.

2 participants