Bug #66335
closedCan not pass options to a Domain Model Validator
0%
Description
In the method \TYPO3\CMS\Extbase\Validation\ValidatorResolver::addCustomValidators the corresponding Validator (based on the model name) instance is created without any options passed to it:
protected function addCustomValidators($targetClassName, ConjunctionValidator &$conjunctionValidator) { $addedValidatorClassName = NULL; // @todo: get rid of ClassNamingUtility usage once we dropped underscored class name support $possibleValidatorClassName = ClassNamingUtility::translateModelNameToValidatorName($targetClassName); $customValidator = $this->createValidator($possibleValidatorClassName); if ($customValidator !== NULL) { $conjunctionValidator->addValidator($customValidator); $addedValidatorClassName = get_class($customValidator); } // @todo: find polytype validator for class }
So if we have a such Validator with some required options - the exception \TYPO3\CMS\Extbase\Validation\Exception\InvalidValidationOptionsException with code:1379981891 will be throwed while constructing the validator (if it extends \TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator of course).
Now the only way to avoid this, is to give some specific name to the Validator and assign it manually in the Controller.
Maybe, if there is no obvious way how to construct the Validator with an options - this method should be removed, since it doesn't provide enough flexibility, as manual assignment does?
Updated by Wouter Wolters over 9 years ago
- Assignee deleted (
Alexander Schnitzler)
Updated by Steffen Gebert over 9 years ago
Thanks for reporting this issue. Please do not add watchers (although the issue tracker allows you to do so). Please leave it up for the individuals to watch an issue.
Updated by Benni Mack over 4 years ago
- Status changed from New to Needs Feedback
Thanks for the issue and sorry for reporting so late.
The code does not exist anymore, and we've reworked this part. It is possible to send options into Extbase Validators, but I'm not sure if I understood your use case correctly.
Could you share with us how you'd expect to define options for the validator?
Updated by Riccardo De Contardi about 4 years ago
- Status changed from Needs Feedback to Closed
I close this issue for now for lack of feedback; if you think that this is the wrong decision or experience the issue again with modern TYPO3 versions, please reopen it or ping me and I'll do.
Thank you.