For exmample: We have table "book" with different type('Horror', 'Travel', 'History'); Need to create method update for this books, but for every type need to show different type of form. How to do it?
Is it correct?
public function actionUpdate($id)
{
$model = $this->getType($id);
switch ($model->type){
case Book::TYPE_HORROR:
return $this->render('update_horror', [
'model' => $model
]);
break;
case Book::TYPE_TRAVEL:
return $this->render('update_travel', [
]);
break;
case Book::TYPE_HISTORY:
return $this->render('update_history', [
]);
}
throw new NotFoundHttpException;
}
No responses yet.