* model: sort methods.

This commit is contained in:
liugang
2023-11-07 16:49:50 +08:00
parent d372384ded
commit e7fcff7ae2
+39 -39
View File
@@ -52,6 +52,45 @@ class model extends baseModel
return parent::loadTao($moduleName);
}
/**
* Load dao of bi.
*
* @access public
* @return void
*/
public function loadBIDAO()
{
global $config, $biDAO;
if(is_object($biDAO)) return $this->dao = $biDAO;
if(!isset($config->biDB)) return;
$driver = $config->db->driver;
$biDAO = new $driver();
$biDAO->slaveDBH = $this->app->connectByPDO($config->biDB, 'BI');
$this->dao = $biDAO;
}
/**
* 通过对象ID获取对象信息。
* Get object information by ID.
*
* @param int $objectID
* @param string $moduleName
* @access public
* @return object|bool
*/
public function fetchByID(int $objectID, string $moduleName = ''): object|bool
{
if(empty($objectID)) return false;
if(empty($moduleName)) $moduleName = $this->getModuleName();
$table = $this->config->objectTables[$moduleName];
return $this->dao->findById($objectID)->from($table)->fetch();
}
/**
* 删除记录
* Delete one record.
@@ -225,24 +264,6 @@ class model extends baseModel
return $menu;
}
/**
* 通过对象ID获取对象信息。
* Get object information by ID.
*
* @param int $objectID
* @param string $moduleName
* @access public
* @return object|bool
*/
public function fetchByID(int $objectID, string $moduleName = ''): object|bool
{
if(empty($objectID)) return false;
if(empty($moduleName)) $moduleName = $this->getModuleName();
$table = $this->config->objectTables[$moduleName];
return $this->dao->findById($objectID)->from($table)->fetch();
}
/**
* Process status of an object according to its subStatus.
*
@@ -412,25 +433,4 @@ class model extends baseModel
$app->triggerError("the module {$moduleName} has no {$method} method", __FILE__, __LINE__, true);
}
/**
* Load dao of bi.
*
* @access public
* @return void
*/
public function loadBIDAO()
{
global $config, $biDAO;
if(is_object($biDAO)) return $this->dao = $biDAO;
if(!isset($config->biDB)) return;
$driver = $config->db->driver;
$biDAO = new $driver();
$biDAO->slaveDBH = $this->app->connectByPDO($config->biDB, 'BI');
$this->dao = $biDAO;
}
}