Mapping to a subclass by __type property fails if subclass adds fields
I have a hierarchy of classes for which an object should be created from a form. For that, I use the feature added with #30300. This all works well until I have a new field in my subclass that is not present in the base class. Then I get the following message on submitting my form:
#1297759968: Exception while property mapping at property path "": Property "text" was not found in target object of type "MyCompany\MyPackage\Domain\Model\BaseClass".
This is caused by the subtype resolving done after the subproperties to map are found. The whole magic is done in
PropertyMapper::doMapping(): First the type converter is created, then all subproperties (of the base class, as annotated in my controller action) are fetched in
getSourceChildPropertiesToBeConverted(). After this, the object should be created, but the mapping fails first because the property does not exist.
The solution is to do the final type resolution directly after creating the type converter, before the call to