コード例 #1
0
ファイル: AttrValSearch.php プロジェクト: cboy868/nana
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params, $id = null)
 {
     $query = AttrVal::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $query->andFilterWhere(['attr_id' => $id]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'cover' => $this->cover, 'price' => $this->price, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'val', $this->val]);
     return $dataProvider;
 }