private function getResourcePath($id) { if (($res = Resources::findOne($id)) !== null) { $path = $res->alias; $path = $this->getCategoryPath($res->category_id) . $path; } else { $path = '#wrs-' . $id; } return $path; }
private function getStoreInfo() { $path = []; switch ($this->tableId) { case Resources::$tableId: $model = Resources::findOne($this->id); $handler = $model->category->handler; $route = $model->route; break; case Categories::$tableId: $model = Categories::findOne($this->id); $handler = $model->handler; $route = $model->route; break; default: throw new InvalidConfigException('FileUploadModel - неизвестный ID таблицы'); break; } $contrClass = Yii::$app->controllerNamespace . '\\' . ucfirst($handler) . 'Controller'; $path = $contrClass::baseStorePath(); $path['route'] = $route; return $path; }
/** */ protected function findModel($id) { if (($model = Resources::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
protected function findAlbum($id) { if (($model = Resources::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('Ресурс не найден'); } }
protected function findModel($id) { if ($id != 0) { if (($model = Resources::findOne($id)) !== null) { return $model; } } else { if (($model = Categories::findByAlias('0', 0)->resources[0]) !== null) { return $model; } } throw new NotFoundHttpException('The requested page does not exist.'); }