6 use yii\data\ActiveDataProvider;
10 * TypesSearch represents the model behind the search form of `app\models\Types`.
12 class TypesSearch extends Types
17 public function rules()
28 public function scenarios()
30 // bypass scenarios() implementation in the parent class
31 return Model::scenarios();
35 * Creates data provider instance with search query applied
37 * @param array $params
39 * @return ActiveDataProvider
41 public function search($params)
43 $query = Types::find();
45 // add conditions that should always apply here
47 $dataProvider = new ActiveDataProvider([
51 $dataProvider->setSort([
59 if (!$this->validate())
61 // uncomment the following line if you do not want to return any records when validation fails
62 // $query->where('0=1');
66 // grid filtering conditions
67 $query->andFilterWhere([
71 $query->andFilterWhere(['ilike', 'name', $this->name]);