/**
  * Updates an existing Stats model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     // @todo: user specific
     $deck_options_tmp = Deck::find()->all();
     foreach ($deck_options_tmp as $deck) {
         $deck_options[$deck['id']] = $deck['name'];
     }
     $deck_type_options_tmp = DeckTypes::find()->all();
     foreach ($deck_type_options_tmp as $deck_type) {
         $deck_type_options[$deck_type['id']] = $deck_type['name'];
     }
     $classes_options_tmp = Classes::find()->all();
     foreach ($classes_options_tmp as $class) {
         $classes_options[$class['id']] = $class['name'];
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('update', ['model' => $model, 'deck_options' => $deck_options, 'deck_type_options' => $deck_type_options, 'classes_options' => $classes_options]);
     }
 }
 /**
  * Finds the DeckTypes model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return DeckTypes the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = DeckTypes::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 public function getDeckTypes()
 {
     return $this->hasOne(DeckTypes::className(), ['id' => 'deck_types_id']);
 }