/** * @param string $keyHierarchy the key locator for the message * @param type $message */ public function error(ValidationResponse $error) { $error->setName($this->wrappedComponet->getId()); $error->setValue($this->getValue()); $message = $this->wrappedComponet->getLocalizer()->getString($this->wrappedComponet->getComponentKey($error->getKey()), new BasicModel($error)); $this->wrappedComponet->error($message); $this->wrappedComponet->invalid(); }
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 validateValue(Validatable $validateable) { $response = parent::validateValue($validateable); if ($response != null) { return $response; } if ($validateable->getValue() < $this->minimum) { $response = new ValidationResponse($this->getKeyName()); $response->addValue('min', $this->minimum); return $response; } }
public function validateValue(Validatable $validateable) { $response = parent::validateValue($validateable); if ($response != null) { return $response; } if (preg_match("/" . $this->pattern . "/", $validateable->getValue()) != 1) { $response = new ValidationResponse($this->getKeyName(), $validateable->getValue()); $response->addValue('expression', $this->pattern); return $response; } }