$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([ 'tax_brand_id' => $this->tax_brand_id, 'product_id' => $this->product_id, ]); $query->andFilterWhere(['like', 'name', $this->name]); return $dataProvider; } public static function findByAlias($alias) { /** @var ProductQuery $query */ $query = Category::find(); $query->byAlias($alias); if (($model = $query->one()) !== null) { return $model; } else { throw new NotFoundHttpException('The requested product does not exist.'); } } }