Ejemplo n.º 1
0
 public function addRule($Validation, $arguments = [])
 {
     if (!$Validation instanceof ValidationInterface) {
         $this->appendRule(Validation::buildRule($Validation, $arguments));
     } else {
         $this->appendRule($Validation);
     }
     return $this;
 }
Ejemplo n.º 2
0
 private function getRule($input)
 {
     if (!isset($input[$this->comparedKey])) {
         throw $this->reportError($this->comparedKey);
     }
     if (!isset($input[$this->baseKey])) {
         throw $this->reportError($this->baseKey);
     }
     try {
         $rule = Validation::__callStatic($this->ruleName, [$input[$this->baseKey]]);
         $rule->setName($this->comparedKey);
     } catch (ComponentException $exception) {
         throw $this->reportError($input, ['component' => true]);
     }
     return $rule;
 }
Ejemplo n.º 3
0
 function __construct(FieldsBuild $field, AssociationBuild $assoc, Validation $v)
 {
     $field->name($v->notEmpty())->alias($v->notEmpty())->location($assoc->belongTo());
 }