diff --git a/framework/model.class.php b/framework/model.class.php index 54a747f89e..3157999ad4 100644 --- a/framework/model.class.php +++ b/framework/model.class.php @@ -223,6 +223,23 @@ 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($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. *