Exemple #1
0
 /**
  * Validate the model
  *
  * If this model has a method called 'validate', model will be passed to
  * ModelValidator::validate() and the validations will be checked, and boolean
  * result returned. Otherwise, returns true.
  *
  * @return boolean
  */
 public function validates()
 {
     if (method_exists($this, 'validate') === true) {
         $result = ModelValidator::validate($this);
         if ($result === true) {
             $return = true;
         } else {
             $this->errors = $result;
             $return = false;
         }
         return $return;
     } else {
         return true;
     }
 }