diff --git a/src/Controller/Component.php b/src/Controller/Component.php index 18d1320..77a742a 100644 --- a/src/Controller/Component.php +++ b/src/Controller/Component.php @@ -205,14 +205,12 @@ class Component } /** - * FIXME: Передавать в модель имя класса, а не часть * Создает модель * @param class-string $modelName * @return mixed */ public function getModel($modelName) { - // $modelName = "App\\Mapper\\" . $name; $model = new $modelName(); $model->config = $this->config; $model->db = $this->db; @@ -300,7 +298,8 @@ class Component */ public function getFields($options = null) { $form = new Form(); - $form->addFieldList($this->getInfo()['parameter'], $options); + $settings = $this->getInfo(); + $form->addFieldList($settings['parameter'], $options); return $form->field; } @@ -485,7 +484,7 @@ class Component * @return mixed */ function actionIndex($request) { - return null; + return ""; } /** diff --git a/src/Controller/Service.php b/src/Controller/Service.php index 47607a9..7e00a06 100644 --- a/src/Controller/Service.php +++ b/src/Controller/Service.php @@ -48,25 +48,14 @@ class Service return Path::join($this->webPath[0], strtolower(get_class($this)), 'templates', 'modern'); } - /** - * @param string $name Имя модели - * @return string - */ - private function getModelPath($name) - { - return Path::join ($this->config->get('system', 'path'), "model", $name . ".php"); - } - /** * Создает модель - * @param string $name + * @param class-string $modelName * @return BaseMapper */ - public function getModel($name) + public function getModel($modelName) { - require_once ($this->getModelPath ($name)); - $modelName = $name . "Mapper"; - $model = new $modelName (); + $model = new $modelName(); $model->db = $this->db; return $model; } diff --git a/src/Excel/Table.php b/src/Excel/Table.php index bb15d3d..b6c7977 100644 --- a/src/Excel/Table.php +++ b/src/Excel/Table.php @@ -230,7 +230,7 @@ class Table /** * Кодирование строки - * @deprecated + * @deprecated Можно заменить на значение * @param string $s Строка * @return string */ @@ -275,7 +275,7 @@ class Table } else { $doc->writeAttribute('ss:Type', "Number"); } - $doc->writeCdata($this->encode($value)); + $doc->writeCdata($value); } $doc->endElement(); $doc->endElement(); diff --git a/src/View/FakeTemplate.php b/src/View/FakeTemplate.php index bd0f952..223fa46 100644 --- a/src/View/FakeTemplate.php +++ b/src/View/FakeTemplate.php @@ -27,6 +27,6 @@ class FakeTemplate extends \stdClass { * @return string */ function execute() { - return json_encode($this->_data); + return json_encode($this->_data) ?: ''; } }