I did it wrong, the request was written in the action method in the controller. How now to rewrite it so that the method itself was in the Content model, and in the actionAlbum controller it was called and rendered the view return $ this-> render ('album'). Somehow I did not find info on this topic
public function actionAlbum($id) { $query = Content::find() ->select('content.*') ->with('category') ->where(['category_id' => $id]); $pagination = new Pagination(['totalCount' => $query->count(), 'pageSize'=>6]); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'pagination' => $pagination ]); return $this->render('album', [ 'dataProvider' => $dataProvider, 'pagination' => $pagination, ]); }