You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a @TODO on AutoMapperPlus\Configuration\Mapping::shouldCheckForSourceProperty() method.
Indeed certain operations needs extra Interface to skip property existence check.
For instance, I don't want certain properties to be mapped into destination object. The way it works now is perfect (with Ignore operation) but there is one problem: when I specify this operation on virtual property (i.e. in Laravel there is a lot of magic happens on models) forMember method will try to ensure source property exist. But it has no sense due to meaning of Ignore operation.
Also you have great PropertyAccessorInterface object, please utilize it to check property can be reached instead of default PHP function within forMember method.
Thanks in advance, great Tool!
The text was updated successfully, but these errors were encountered:
Yes, these are very valid points. In fact, as a short term solution I removed the checking of source properties entirely a few days ago, in a9e5590. This isn't part of release yet though, it's only available on dev-master. So if this is causing you problems, you can check out this version for now.
The reason for removing this behaviour is indeed because it doesn't really work with dynamic properties. For the long term it might be better to work with an interface or something similar. but this will require some more thought.
There is a
@TODO
onAutoMapperPlus\Configuration\Mapping::shouldCheckForSourceProperty()
method.Indeed certain operations needs extra Interface to skip property existence check.
For instance, I don't want certain properties to be mapped into destination object. The way it works now is perfect (with
Ignore
operation) but there is one problem: when I specify this operation on virtual property (i.e. in Laravel there is a lot of magic happens on models)forMember
method will try to ensure source property exist. But it has no sense due to meaning ofIgnore
operation.Also you have great
PropertyAccessorInterface
object, please utilize it to check property can be reached instead of default PHP function withinforMember
method.Thanks in advance, great Tool!
The text was updated successfully, but these errors were encountered: