Bug #85932
closedIncorrect annotation for property "message" in class "Error".
0%
Description
Try to create action like here :
/**
* @param \TYPO3\CMS\Extbase\Error\Result|null $validationErrors
*/
public function listContactAction(\TYPO3\CMS\Extbase\Error\Result $validationErrors = null)
{
}
Now try to open frontend, error is :
Oops, an error occurred!
There is no @var annotation for property "message" in class "Error".
How I check problem is here web/typo3/sysext/extbase/Classes/Error/Result.php
Now we have
/**
* @var Error[]
*/
protected $errors = [];
should be :
/**
* @var \TYPO3\CMS\Extbase\Error\Error[]
*/
protected $errors = [];
Files
Updated by Gerrit Code Review about 6 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58043
Updated by Markus Klein about 6 years ago
- Status changed from Under Review to Needs Feedback
- Target version deleted (
8.7.19)
I don't get your example action? Why do you pass this error stuff in there?
Updated by Patryk Ostrowski about 6 years ago
- File Selection_933.png Selection_933.png added
Error stuff is here because we don't need validation at the start of action. We validate object only in some case. In some other we save not valid object.
As example for better understanding i will show you this simple story:
- User want to create new invoice address (address is another object with 30 fields)
- We allow him to create it with 4 steps, 3 steps per 10 fields and on last, he get confirmation
- OK, User enter on the step 1, he fill 3 fields after this he see field which is strange for him but this fields is required, so in this case he want to save his work. We allow him with special button.
- after some time User return to edit his Address
- he fill all required fields and click proceed button. Crap, he forget about one required field, he is very angry for this field and he closed browser. After some minutes he return to form and he see, his form is saved! With proceed action we always save object and after save we validate it to check if he can go to another step.
Ok, i finish this simple story in this moment, because now, you should know why we want to use
TYPO3\CMS\Extbase\Error\Result
Maybe fix solution for this problem is not correct but this should be fixed. The problem is in
typo3/cms/typo3/sysext/extbase/Classes/Reflection/ReflectionService.php::getPropertyTagsValues
ReflectionService::getPropertyTagsValues should return class Property tag valuse but in case of Error return empty array (see screenshot why empty array is returned)
Maybe fix should be for reflection service? Because error is thrown by:
$classPropertyTagsValues = $this->reflectionService->getPropertyTagsValues($targetClassName, $classPropertyName); if (!isset($classPropertyTagsValues['var'])) { throw new \InvalidArgumentException(sprintf('There is no @var annotation for property "%s" in class "%s".', $classPropertyName, $targetClassName), 1363778104); }
from class
typo3/cms/typo3/sysext/extbase/Classes/Validation/ValidatorResolver.php::276
Updated by Markus Klein about 6 years ago
So you actually still want to pass in the object but you would want to add a @ignorevalidation $address flag in phpdoc to the method to disable validation, right?
Updated by Patryk Ostrowski about 6 years ago
- Related to Bug #57856: @inject does not work relative to current namespace added
Updated by Patryk Ostrowski about 6 years ago
I added some related issue. Maybe its can help with problem identification. Especially interesting is task from typo3 flow, its looks like possible solution for this problem: https://forge.typo3.org/issues/46008 and https://forge.typo3.org/issues/57034
Updated by Markus Klein about 6 years ago
The problem is not the missing namespace resolvement (which is known and unfortunate, but no blocker), but obviously your wrong design of the action. An action takes models or other GET/POST parameters as method arguments, not a validation (or what so ever).
Updated by Patryk Ostrowski about 6 years ago
If the problem is known and reported i think we can close this task. Solution for our problem is to not use:
* @param \TYPO3\CMS\Extbase\Error\Result|null $validationErrors
Thanks Markus for help.
Updated by Markus Klein about 6 years ago
- Status changed from Needs Feedback to Closed