/**
  * @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;
     }
 }
Exemplo n.º 3
0
 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;
     }
 }
Exemplo n.º 4
0
 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;
     }
 }