public function run() { $model = new SourceForm(); $model->version = \Yii::$app->docParser->load()->getVersion(); $versions = \Yii::$app->docParser->load()->getVersions(); $versions = array_flip($versions); foreach ($versions as $key => $value) { $versions[$key] = 'Version ' . $key; if ($key == ParamsHelper::getVersion()) { $versions[$key] .= ' (on server)'; } } return $this->render('navBarWidget', ['model' => $model, 'versions' => $versions]); }
/** * Склейка всех объектов в один файл definitions * @throws Exception */ public function buildDefinitions() { $saveVersion = ParamsHelper::getVersion(); Yii::$app->params['version'] = $this->getVersion(); $definitions = $this->getDefinitions(); $objects = $this->getObjects(); $data = ['definitions' => $objects]; $content = json_encode($data); file_put_contents($definitions, $content); @chmod($definitions, 0777); Yii::$app->params['version'] = $saveVersion; }