From 79d04fed0d7a64940431fcbee2cb7e2f18e473c7 Mon Sep 17 00:00:00 2001 From: Chris Penny Date: Mon, 22 Feb 2021 08:13:54 +1300 Subject: [PATCH] CompositeValidator::validate() to call validate() instead of php() --- src/Forms/CompositeValidator.php | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/src/Forms/CompositeValidator.php b/src/Forms/CompositeValidator.php index 61ead41c9..60fc3b15a 100644 --- a/src/Forms/CompositeValidator.php +++ b/src/Forms/CompositeValidator.php @@ -95,24 +95,9 @@ class CompositeValidator extends Validator return $this->result; } - $data = $this->form->getData(); - foreach ($this->getValidators() as $validator) { - // Reset the validation results for this Validator - $validator->resetResult(); - - // 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()); + // validate() will return a ValidationResult, and we will combine this with the result we already have + $this->getResult()->combineAnd($validator->validate()); } return $this->result;