示例#1
0
 /**
  * Adds another validator to this instance
  *
  * This checks to see if the current validator is an "Collection\All" instance.
  * If it is, then it adds the given validator on to the list. If it isn't,
  * then it wraps the current validator and the validator in the instance in
  * an All validator and sets it to the validator for this instance.
  *
  * @param \r8\iface\Validator $validator The validator to add to this instance
  * @return \r8\Form\Field Returns a self reference
  */
 public function andValidator(\r8\iface\Validator $validator)
 {
     if ($this->validator instanceof \r8\Validator\All) {
         $this->validator->add($validator);
     } else {
         $this->validator = new \r8\Validator\All($this->validator, $validator);
     }
     return $this;
 }