Bug #34134
PropertyMapper throws unnecessary exception
Status: | Needs Feedback | Start date: | 2012-02-21 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | Christian Müller | % Done: | 0% |
|
Category: | Property | |||
Target version: | - | |||
PHP Version: | Complexity: | |||
Has patch: | Yes | Affected Flow version: | Git master |
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; }
History
#1 Updated by Kira Backes over 3 years ago
- Project changed from TYPO3 Flow Base Distribution to TYPO3.Flow
#2 Updated by Kira Backes over 3 years ago
Here is a better solution so you can still get all errors for all properties and you still won’t get an exception even for a lot of nested problems.
Change this (\TYPO3\FLOW3\Property\PropertyMapper:169):
$result = $typeConverter->convertFrom($source, $targetType, $convertedChildProperties, $configuration);
To:
if ($this->messages->forProperty(implode('.', $currentPropertyPath))->hasErrors()) { return NULL; } $result = $typeConverter->convertFrom($source, $targetType, $convertedChildProperties, $configuration);
#3 Updated by Kira Backes over 3 years ago
That solution still has a flaw, I can’t see all validation errors no more, because the object validation is missing now.. This seems to be an unsolvable problem with the current system.
#4 Updated by Karsten Dambekalns over 3 years ago
- Category set to Property
- Has patch set to Yes
#5 Updated by Christian Müller over 3 years ago
- Status changed from New to Needs Feedback
Hi,
could you please try https://review.typo3.org/#/c/9606/ with your environment? I am not sure if that works out but couldn't come up with a good testing setup.
#6 Updated by Karsten Dambekalns over 3 years ago
- Assigned To set to Christian Müller
#7 Updated by Bastian Waidelich over 1 year ago
Any news on this one?