Exemplo n.º 1
0
 public function saveExam()
 {
     $model = new Exam();
     $model->attributes = $this->attributes;
     if ($model->validate()) {
         $model->save();
     } else {
         foreach ($model->errors as $key => $value) {
             $this->addError($key, $model->getFirstError($key));
         }
     }
     return $model;
 }