Правильное название модели в компонентах. Альтернативная почта
This commit is contained in:
parent
a48bce8552
commit
c680b8c322
5 changed files with 98 additions and 14 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class Controller_Installer
|
|||
foreach ($sql as $version => $install) {
|
||||
if (version_compare($version, $version_new, "<=") && version_compare($version, $version_old, ">")) {
|
||||
$file = Path::join(call_user_func($this->installPath, $name), "sql", $install);
|
||||
$json_installer->install($file,null);
|
||||
$json_installer->install($file, null);
|
||||
$result[] = $version;
|
||||
}
|
||||
}
|
||||
|
|
@ -64,6 +64,7 @@ class Controller_Installer
|
|||
$this->_registry->removeKey($name);
|
||||
$this->_registry->write();
|
||||
}
|
||||
|
||||
// Устанавливает обновления если есть
|
||||
function doUpdates($name, $force = false) // Установка модуля
|
||||
{
|
||||
|
|
@ -83,6 +84,7 @@ class Controller_Installer
|
|||
$version_old = "0.0";
|
||||
$registry->writeKey(array($name), array());
|
||||
}
|
||||
// echo $version_old, $settings->get('version');
|
||||
if (version_compare($version_old, $settings->get('version'), "!=")) {
|
||||
$sql = $settings->get('sql');
|
||||
if (is_array($sql)) {
|
||||
|
|
@ -104,8 +106,8 @@ class Controller_Installer
|
|||
return $result;
|
||||
}
|
||||
|
||||
function install($dbinit_path,$dbfill_path=null){
|
||||
function install($dbinit_path, $dbfill_path = null) {
|
||||
$json_installer = new Database_JsonInstall($this->db_manager);
|
||||
$json_installer->install($dbinit_path,$dbfill_path);
|
||||
$json_installer->install($dbinit_path, $dbfill_path);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue