From e7fcff7ae2c60e7d1b61dc2893bc676b80e7960a Mon Sep 17 00:00:00 2001 From: liugang Date: Tue, 7 Nov 2023 16:49:50 +0800 Subject: [PATCH] * model: sort methods. --- framework/model.class.php | 78 +++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/framework/model.class.php b/framework/model.class.php index 05fdeb14dd..3d0bed6bad 100644 --- a/framework/model.class.php +++ b/framework/model.class.php @@ -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; - } }