/**
  * Creates a new TiposEstadosEmocionais model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new TiposEstadosEmocionais();
     $model->scenario = "create";
     if ($model->load(Yii::$app->request->post())) {
         $image = $model->uploadImage();
         if ($model->save() && $image !== false) {
             // upload only if valid uploaded file instance found
             $path = $model->getImageFile();
             $image->saveAs($path);
             return $this->redirect(['view', 'id' => $model->id_tipo_estado_emocional]);
         }
         //error saving model
         return $this->render('create', ['model' => $model]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }