Skip to content

Commit

Permalink
BaseFormElement: Don't evaluate validators by hand
Browse files Browse the repository at this point in the history
refs #28
  • Loading branch information
nilmerg committed Oct 7, 2021
1 parent ef222ef commit 6de8d6b
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/FormElement/BaseFormElement.php
Expand Up @@ -251,17 +251,8 @@ public function setValue($value)
*/
public function validate()
{
$valid = true;

foreach ($this->getValidators() as $validator) {
if (! $validator->isValid($this->getValue())) {
$valid = false;

$this->addMessages($validator->getMessages());
}
}

$this->valid = $valid;
$this->valid = $this->getValidators()->isValid($this->getValue());
$this->addMessages($this->getValidators()->getMessages());

return $this;
}
Expand Down

0 comments on commit 6de8d6b

Please sign in to comment.