Bug #32829

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

Added by Andreas Wolf over 9 years ago. Updated almost 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
#1

Updated by Gerrit Code Review over 9 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7507

#2

Updated by Gerrit Code Review over 9 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7507

#3

Updated by Gerrit Code Review over 9 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7507

#4

Updated by Karsten Dambekalns over 9 years ago

  • Category set to Property
  • Assignee set to Andreas Wolf
  • Target version set to 1.1
#5

Updated by Gerrit Code Review over 9 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7507

#6

Updated by Gerrit Code Review about 9 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7507

#7

Updated by Gerrit Code Review about 9 years ago

Patch set 6 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7507

#8

Updated by Gerrit Code Review about 9 years ago

Patch set 7 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7507

#9

Updated by Karsten Dambekalns about 9 years ago

  • Target version changed from 1.1 to 1.1 RC1
#10

Updated by Karsten Dambekalns almost 9 years ago

  • Target version changed from 1.1 RC1 to 1.1
#12

Updated by Gerrit Code Review almost 9 years ago

Patch set 8 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7507

#13

Updated by Gerrit Code Review almost 9 years ago

Patch set 9 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7507

#14

Updated by Gerrit Code Review almost 9 years ago

Patch set 10 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7507

#15

Updated by Karsten Dambekalns almost 9 years ago

  • Target version changed from 1.1 to 1.1.1
#16

Updated by Gerrit Code Review almost 9 years ago

Patch set 11 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7507

#17

Updated by Gerrit Code Review almost 9 years ago

Patch set 12 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7507

#18

Updated by Gerrit Code Review almost 9 years ago

Patch set 13 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7507

#19

Updated by Gerrit Code Review almost 9 years ago

Patch set 14 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7507

#20

Updated by Gerrit Code Review almost 9 years ago

Patch set 15 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7507

#21

Updated by Karsten Dambekalns over 8 years ago

  • Target version changed from 1.1.1 to 2052
#22

Updated by Marco Falkenberg over 8 years ago

Are there any news or efforts about solving this bug?

#23

Updated by Gerrit Code Review over 8 years ago

Patch set 16 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/7507

#24

Updated by Andreas Wolf over 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#25

Updated by Gerrit Code Review about 8 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch 2.0 has been pushed to the review server.
It is available at https://review.typo3.org/19095

#26

Updated by Gerrit Code Review about 8 years ago

Patch set 1 for branch FLOW3-1.1 has been pushed to the review server.
It is available at https://review.typo3.org/19096

#27

Updated by Gerrit Code Review about 8 years ago

Patch set 2 for branch FLOW3-1.1 has been pushed to the review server.
It is available at https://review.typo3.org/19096

#28

Updated by Gerrit Code Review about 8 years ago

Patch set 3 for branch FLOW3-1.1 has been pushed to the review server.
It is available at https://review.typo3.org/19096

#29

Updated by Gerrit Code Review about 8 years ago

Patch set 4 for branch FLOW3-1.1 has been pushed to the review server.
It is available at https://review.typo3.org/19096

#30

Updated by Andreas Wolf about 8 years ago

  • Status changed from Under Review to Resolved
#31

Updated by Andreas Wolf about 8 years ago

This still seems to be an issue when changing already persisted objects when the type is not submitted with the form (which may not be desired for several reasons). The reason is that the ObjectConverter does not check if the object has already been persisted (= if $source[__identity] is present) when checking for the target type (in getTargetTypeForSource)

#32

Updated by Karsten Dambekalns almost 8 years ago

  • Target version changed from 2052 to 1.1.1

Also available in: Atom PDF