Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = MArticleMult::find()->where(['gh_id' => Yii::$app->user->getGhid()])->orderBy('article_mult_id DESC');
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['article_mult_id' => $this->article_mult_id, 'create_time' => $this->create_time]);
     $query->andFilterWhere(['like', 'gh_id', $this->gh_id])->andFilterWhere(['like', 'title', $this->title]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 /**
  * 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]);
     }
 }
Ejemplo n.º 3
0
 /**
  * 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.');
     }
 }
Ejemplo n.º 4
0
 public function getArticleMult()
 {
     return $this->hasOne(MArticleMult::className(), ['article_mult_id' => 'article_mult_id']);
 }