Bug #34134

PropertyMapper throws unnecessary exception

Added by Kira Backes over 9 years ago. Updated over 7 years ago.

Status:
Needs Feedback
Priority:
Should have
Category:
Property
Target version:
-
Start date:
2012-02-21
Due date:
% Done:

0%

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

Description

In the case of models with non-optional constructor arguments, you get an exception when one of those subproperties has an error in the TypeConverter. This can be fixed by changing the following (\TYPO3\FLOW3\Property\PropertyMapper:162)

            $currentPropertyPath[] = $targetPropertyName;
            $targetPropertyValue = $this->doMapping($sourcePropertyValue, $targetPropertyType, $subConfiguration, $currentPropertyPath);
            array_pop($currentPropertyPath);
            if ($targetPropertyValue !== NULL) {
                $convertedChildProperties[$targetPropertyName] = $targetPropertyValue;
            }

To the following:

            $currentPropertyPath[] = $targetPropertyName;
            $targetPropertyValue = $this->doMapping($sourcePropertyValue, $targetPropertyType, $subConfiguration, $currentPropertyPath);
            if ($this->messages->forProperty(implode('.', $currentPropertyPath))->hasErrors()) {
                return NULL;
            }
            array_pop($currentPropertyPath);
            if ($targetPropertyValue !== NULL) {
                $convertedChildProperties[$targetPropertyName] = $targetPropertyValue;
            }

Also available in: Atom PDF