public function search($params) { $query = FilmText::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['film_id' => $this->film_id]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = FilmTextModel::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['film_id' => $this->film_id]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description]); return $dataProvider; }
/** * Finds the FilmText model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $film_id * @return FilmText the loaded model * @throws HttpException if the model cannot be found */ protected function findModel($film_id) { if (($model = FilmText::findOne($film_id)) !== null) { return $model; } else { throw new HttpException(404, 'The requested page does not exist.'); } }