Правильное название модели в компонентах. Альтернативная почта

This commit is contained in:
Фёдор Подлеснов 2017-11-24 15:32:03 +03:00
parent a48bce8552
commit c680b8c322
5 changed files with 98 additions and 14 deletions

View file

@ -131,14 +131,6 @@ class Controller_Component
return Path::join($this->webPath[0], 'templates', 'modern');
}
/**
* @param $name Имя модели
*/
private function getModelPath($name)
{
return Path::join (CMS_PATH, "model", $name . ".php");
}
/**
* Создает модель
* @param string $name
@ -146,9 +138,8 @@ class Controller_Component
*/
public function getModel($name)
{
require_once ($this->getModelPath ($name));
$modelName = $name . "Mapper";
$model = new $modelName ();
$modelName = "Mapper_" . $name;
$model = new $modelName();
$model->db = $this->db;
return $model;
}