chore: Мелкие правки

This commit is contained in:
origami11@yandex.ru 2025-11-27 13:45:45 +03:00
parent 0473d410d1
commit 3e0b99c3d2
4 changed files with 9 additions and 21 deletions

View file

@ -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 "";
}
/**

View file

@ -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;
}

View file

@ -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();

View file

@ -27,6 +27,6 @@ class FakeTemplate extends \stdClass {
* @return string
*/
function execute() {
return json_encode($this->_data);
return json_encode($this->_data) ?: '';
}
}