clearErrors() public méthode

Removes errors for all attributes or a single attribute.
public clearErrors ( string $attribute = null )
$attribute string attribute name. Use null to remove errors for all attributes.
 /**
  * @param Event $event event parameter.
  */
 public function afterValidate($event)
 {
     if (!$this->getIsNeedValidate()) {
         $this->owner->clearErrors($this->attribute);
     }
     if ($this->owner->hasErrors()) {
         $this->addAttempt();
     } else {
         $this->removeAttempts();
     }
 }