These allows manage the required message like any other ValidatorInterface element.
Note: While you can add the validator manually the flag setRequired must be set too
$input = new Input();
$input->setRequired(true);empty value instead *not set*.
$input->getValidatorChain()->attach(
new Zend\InputFilter\Validator\Required(),
true // break chain on failure
);
$inputSpecification = [
'required' => true,
'validators' => [
[
'break_chain_on_failure' => true,
'name' => 'Zend\\InputFilter\\Validator\\Required',
],
],
];
Note: setRequired(false) may not be enough and you will need remove the validator from the chain.
Originally posted by @Maks3w at zendframework/zend-inputfilter#62
These allows manage the required message like any other ValidatorInterface element.
Note: While you can add the validator manually the flag
setRequiredmust be set tooNote:
setRequired(false)may not be enough and you will need remove the validator from the chain.Originally posted by @Maks3w at zendframework/zend-inputfilter#62