예제 #1
0
파일: BaseField.php 프로젝트: jarick/bx
 /**
  * Validate input data
  *
  * @param array $data
  * @return boolean
  */
 public function validate(array &$data)
 {
     $this->validator->notEmpty(!$this->required);
     if ($this->multy) {
         $this->validator = MultyValidator::create($this->validator);
     }
     if (!$this->validator->validate($this->name, $this->value, $this->label, $data)) {
         foreach ($this->validator->getErrors()->all() as $message) {
             $this->addError($message);
         }
         return false;
     }
     return true;
 }
예제 #2
0
 /**
  * Create validator
  * @param \BX\Validator\IValidator $validator
  * @return Multy
  */
 public static function create(IValidator $validator)
 {
     $return = parent::create();
     $return->setValidator($validator);
     return $return;
 }