private function getRouteModel($action) { $route = $this->id . '/' . $action->id; $routeModel = RbacRoute::findOne(['name' => $route]); if (is_null($routeModel)) { throw new HttpException(500, 'Internal Server Error'); } else { return $routeModel; } }
/** * Finds the RbacRoute model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * * @param int $id * * @return RbacRoute the loaded model * * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = RbacRoute::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }