$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; } // grid filtering conditions $query->andFilterWhere( [ 'entity' => $this->entity, ] ); $query->andFilterWhere( [ 'ilike', 'value', $this->search, ] ); // If language_id == 0, search for records with null language if ($this->language_id === '0') { $query->andWhere( [ 'language_id' => null, ] ); } else { $query->andFilterWhere( [ 'language_id' => $this->language_id, ] ); } // If language_id == 0, search for records without entities if ($this->static === '0') { $query->andWhere( [ 'entity' => null, ] ); } elseif ($this->static === '1') { $query->andWhere( [ 'not', [ 'entity' => null, ], ] ); } return $dataProvider; } }