public function createValidator($validatorIdentifier, array $options = [])
    {
        $validatorPresets = $this->getRootForm()->getValidatorPresets();
        if (isset($validatorPresets[$validatorIdentifier]) && is_array($validatorPresets[$validatorIdentifier]) && isset($validatorPresets[$validatorIdentifier]['implementationClassName'])) {
            $implementationClassName = $validatorPresets[$validatorIdentifier]['implementationClassName'];
            $defaultOptions = isset($validatorPresets[$validatorIdentifier]['options']) ? $validatorPresets[$validatorIdentifier]['options'] : [];

            $options = Arrays::arrayMergeRecursiveOverrule($defaultOptions, $options);

            $validator = new $implementationClassName($options);
            $this->addValidator($validator);
            return $validator;
        } else {
            throw new ValidatorPresetNotFoundException('The validator preset identified by "' . $validatorIdentifier . '" could not be found, or the implementationClassName was not specified.', 1328710202);
        }
    }
public function createValidator($validatorIdentifier, array $options = [])
    {
        $validatorPresets = $this->getRootForm()->getValidatorPresets();
        if (isset($validatorPresets[$validatorIdentifier]) && is_array($validatorPresets[$validatorIdentifier]) && isset($validatorPresets[$validatorIdentifier]['implementationClassName'])) {
            $implementationClassName = $validatorPresets[$validatorIdentifier]['implementationClassName'];
            $defaultOptions = isset($validatorPresets[$validatorIdentifier]['options']) ? $validatorPresets[$validatorIdentifier]['options'] : [];

            $options = Arrays::arrayMergeRecursiveOverrule($defaultOptions, $options);

            $validator = new $implementationClassName($options);
            $this->addValidator($validator);
            return $validator;
        } else {
            throw new ValidatorPresetNotFoundException('The validator preset identified by "' . $validatorIdentifier . '" could not be found, or the implementationClassName was not specified.', 1328710202);
        }
    }
public function createValidator ( $ validatorIdentifier , array $ options = [ ] ) { $ validatorPresets = $ this -> getRootForm ( ) -> getValidatorPresets ( ) ; if ( isset ( $ validatorPresets [ $ validatorIdentifier ] ) && is_array ( $ validatorPresets [ $ validatorIdentifier ] ) && isset ( $ validatorPresets [ $ validatorIdentifier ] [ 'implementationClassName' ] ) ) { $ implementationClassName = $ validatorPresets [ $ validatorIdentifier ] [ 'implementationClassName' ] ; $ defaultOptions = isset ( $ validatorPresets [ $ validatorIdentifier ] [ 'options' ] ) ? $ validatorPresets [ $ validatorIdentifier ] [ 'options' ] : [ ] ; $ options = Arrays :: arrayMergeRecursiveOverrule ( $ defaultOptions , $ options ) ; $ validator = new $ implementationClassName ( $ options ) ; $ this -> addValidator ( $ validator ) ; return $ validator ; } else { throw new ValidatorPresetNotFoundException ( 'The validator preset identified by "' . $ validatorIdentifier . '" could not be found, or the implementationClassName was not specified.' , 1328710202 ) ; } }
Create a validator for the element

@param string $validatorIdentifier
@param array $options
@return mixed
@throws ValidatorPresetNotFoundException
Create a validator for the element