typePublic(); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort' => [ 'defaultOrder' => ['id' => SORT_DESC] ] ]); $this->load($params); if (!$this->validate()) { $query->where('0=1'); return $dataProvider; } $query->andFilterWhere([ 'id' => $this->id, 'category_id' => $this->category_id, ]); $query ->andFilterWhere(['like', 'title', $this->title]); return $dataProvider; } public function categoriesList(): array { return ArrayHelper::map(BlogCategory::find()->orderBy('sort')->asArray()->all(), 'id', 'title'); } public function statusList(): array { return BlogPostHelper::statusList(); } }