Feature #44738

Re-Validation of argument's custom validators

Added by Marco Falkenberg over 2 years ago.

Status:New Start date:2013-01-23
Priority:Must have Due date:
Assigned To:- % Done:

0%

Category:Validation
Target version:-
PHP Version: Complexity:
Has patch:No

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.

Also available in: Atom PDF