Example #1
0
 /**
  * Collect model errors
  *
  * @param Model $model the model to be validated
  * @return array the error message array indexed by the attribute IDs.
  */
 public static function collectErrors($model)
 {
     $result = [];
     /* @var $model Model */
     $models = [$model];
     foreach ($models as $model) {
         foreach ($model->getErrors() as $attribute => $errors) {
             $result[Html::getInputId($model, $attribute)] = $errors;
         }
     }
     return $result;
 }
Example #2
0
 public function getErrors()
 {
     return $this->model->getErrors();
 }