Bug #32829

Mapping to a subclass by __type property fails if subclass adds fields

Added by Andreas Wolf almost 10 years ago. Updated about 8 years ago.

Status:
Resolved
Priority:
Should have
Assignee:
Category:
Property
Start date:
2011-12-24
Due date:
% Done:

100%

Estimated time:
PHP Version:
5.3
Has patch:
Yes
Complexity:

Description

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 getSourceChildPropertiesToBeConverted().


Related issues

Related to TYPO3.Flow - Feature #30300: Support mapping to subclass by argumentResolvedChristopher Hlubek2011-09-26

Actions

Also available in: Atom PDF