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 d61823b commit 2e720c2
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/FormElement/BaseFormElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,17 +243,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 2e720c2

Please sign in to comment.