Feature #44738

Re-Validation of argument's custom validators

Added by Marco Falkenberg about 8 years ago.

Status:
New
Priority:
Must have
Assignee:
-
Category:
Validation
Target version:
-
Start date:
2013-01-23
Due date:
% Done:

0%

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

Description

There are situation where the automatic validation of arguments, that happens BEFORE passing the arguments to the action-method, is not enough. The validation should be able to be reactivated in the controller-action. E.g if you do some business logic inside the action.

A very simple and common example, is where you want to validate an item after adding some sub-items to it:

public function addChildAction(Parent $parent, Child $child) {
  $parent->addChild($child);
  $this->revalidateArguments();
}
class BadNameChoiceValidator extends \TYPO3\Flow\Validation\Validator\GenericObjectValidator {

  protected function isValid($parent) {
    foreach($parent->getChilds() as $child) {
      if($parent->lastName === 'Walker' && $child->firstName === 'Johnny') {
        $this->addError('Name is to alcoholic!', 1357116916);
      }
    }
  }

}

Thus the ValidatorInterface should have a reset-method. E.g. the ObjectValidator could reset its validatedInstancesContainer there.

No data to display

Also available in: Atom PDF