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 * @param class-string $modelName
* @return mixed * @return mixed
*/ */
public function getModel($modelName) public function getModel($modelName)
{ {
// $modelName = "App\\Mapper\\" . $name;
$model = new $modelName(); $model = new $modelName();
$model->config = $this->config; $model->config = $this->config;
$model->db = $this->db; $model->db = $this->db;
@ -300,7 +298,8 @@ class Component
*/ */
public function getFields($options = null) { public function getFields($options = null) {
$form = new Form(); $form = new Form();
$form->addFieldList($this->getInfo()['parameter'], $options); $settings = $this->getInfo();
$form->addFieldList($settings['parameter'], $options);
return $form->field; return $form->field;
} }
@ -485,7 +484,7 @@ class Component
* @return mixed * @return mixed
*/ */
function actionIndex($request) { 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'); 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 * @return BaseMapper
*/ */
public function getModel($name) public function getModel($modelName)
{ {
require_once ($this->getModelPath ($name)); $model = new $modelName();
$modelName = $name . "Mapper";
$model = new $modelName ();
$model->db = $this->db; $model->db = $this->db;
return $model; return $model;
} }

View file

@ -230,7 +230,7 @@ class Table
/** /**
* Кодирование строки * Кодирование строки
* @deprecated * @deprecated Можно заменить на значение
* @param string $s Строка * @param string $s Строка
* @return string * @return string
*/ */
@ -275,7 +275,7 @@ class Table
} else { } else {
$doc->writeAttribute('ss:Type', "Number"); $doc->writeAttribute('ss:Type', "Number");
} }
$doc->writeCdata($this->encode($value)); $doc->writeCdata($value);
} }
$doc->endElement(); $doc->endElement();
$doc->endElement(); $doc->endElement();

View file

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