public function validate(Validatable $validateable) { if ($validateable->isValid()) { $response = $this->validateValue($validateable); if ($response != null && $response instanceof ValidationResponse) { $validateable->error($response); } } }
public function validate(Validatable $field) { $value = $field->getValue(); if ($value == '') { if ($this->required) { $field->setError('is verplicht'); return false; } } return true; }
public function validateValue(Validatable $validateable) { //@todo don't call validate() like this $this->other->validate(); $oValidatable = new ValidatableFormComponentWrapper($this->other); if ($validateable->getValue() != $oValidatable->getValue()) { $response = new ValidationResponse($this->getKeyName(), $validateable->getValue()); $response->addValue('other', $this->other->getId()); return $response; } }
public function validate(Validatable $field) { if ($field->getValue() == '' && !$this->required) { return true; } if (parent::validate($field)) { if (preg_match('/^[^@]+@[a-zA-Z0-9._-]+\\.[a-zA-Z]+$/', $field->getValue()) != 1) { $field->setError('is geen geldig e-mailadres'); return false; } return true; } return false; }
public function validateValue(Validatable $validateable) { if (!is_string($validateable->getValue())) { return new ValidationResponse($this->getKeyName(get_class())); } }