Project

General

Profile

Actions

Bug #66335

closed

Can not pass options to a Domain Model Validator

Added by Taras Zakus about 9 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2015-04-09
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

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?

Actions #1

Updated by Wouter Wolters about 9 years ago

  • Assignee deleted (Alexander Schnitzler)
Actions #2

Updated by Steffen Gebert about 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.

Actions #3

Updated by Benni Mack over 3 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?

Actions #4

Updated by Riccardo De Contardi over 3 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.

Actions

Also available in: Atom PDF