Example #1
0
 /**
  * Validates the given data against this constraint. If the constraint was
  * already triggered before, then it will return the last result.
  *
  * @param mixed $data The data
  *
  * @return boolean
  */
 public function validate(Field $field, $data)
 {
     if (true === $this->checked) {
         return;
     }
     $this->checked = true;
     if (true === $this->check($data)) {
         return;
     }
     $field->addError(new Error($field->getInternalName(), $this->getMessage()));
 }