/** * Creates a new MArticleMultArticle model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate($article_mult_id) { $articleMult = MArticleMult::findOne($article_mult_id); $model = new MArticleMultArticle(); $model->article_mult_id = $article_mult_id; if ($model->load(Yii::$app->request->post()) && $model->save()) { // return $this->redirect(['view', 'id' => $model->article_mult_article_id]); return $this->redirect(['index', 'article_mult_id' => $model->article_mult_id]); } else { return $this->render('create', ['model' => $model, 'articleMult' => $articleMult]); } }
/** * Finds the MArticleMult model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return MArticleMult the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = MArticleMult::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }