コード例 #1
0
ファイル: TopicSearch.php プロジェクト: Ramengel/yii_fl
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Topic::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['topic_id' => $this->topic_id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'author_id' => $this->author_id, 'category_id' => $this->category_id, 'title_content' => $this->title_content, 'topic_image' => $this->topic_image]);
     $query->andFilterWhere(['like', 'author', $this->author])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'title', $this->title_content])->andFilterWhere(['like', 'data', $this->data]);
     return $dataProvider;
 }