public function actionCategory($categoryId) { $category = RecipeCategory::findOne($categoryId); if (empty($category)) { throw new NotFoundHttpException('The requested page does not exist.'); } $searchModel = new PortionRepository(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render(['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'categoryName' => $category->name]); }
/** * @param $id * @return null|Portion */ public static function findById($id) { return PortionRepository::searchOne($id); }