mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #9869 from chrispenny/bugfix/composite-validator-calls-php
CompositeValidator::validate() to call validate() instead of php(). Fixes #9868
This commit is contained in:
commit
0361f10f4c
@ -95,24 +95,9 @@ class CompositeValidator extends Validator
|
|||||||
return $this->result;
|
return $this->result;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $this->form->getData();
|
|
||||||
|
|
||||||
foreach ($this->getValidators() as $validator) {
|
foreach ($this->getValidators() as $validator) {
|
||||||
// Reset the validation results for this Validator
|
// validate() will return a ValidationResult, and we will combine this with the result we already have
|
||||||
$validator->resetResult();
|
$this->getResult()->combineAnd($validator->validate());
|
||||||
|
|
||||||
// This Validator has been disabled, so skip it
|
|
||||||
if (!$validator->getEnabled()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run validation, and exit early if it's valid
|
|
||||||
if ($validator->php($data)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validation result was invalid. Combine our ValidationResult messages
|
|
||||||
$this->getResult()->combineAnd($validator->getResult());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->result;
|
return $this->result;
|
||||||
|
Loading…
Reference in New Issue
Block a user