* Refactor the magic method to support call static method. Only static

methods of classes declared in a zen file or an ext zen file or a tao
file or an ext tao file can be called.
This commit is contained in:
Guan Xiying
2022-10-20 10:28:35 +08:00
parent 1cbb4546fd
commit 86df3868fb
2 changed files with 7 additions and 3 deletions
+4 -2
View File
@@ -367,9 +367,11 @@ class model extends baseModel
public static function __callStatic($method, $arguments)
{
global $app;
$moduleName = $app->getModuleName();
$taoClass = $moduleName . 'Tao';
$moduleName = get_called_class();
$taoClass = 'ext' . $moduleName . 'Tao';
if(is_callable("{$taoClass}::{$method}")) return call_user_func_array("{$taoClass}::{$method}", $arguments);
$taoClass = $moduleName . 'Tao';
if(is_callable("{$taoClass}::{$method}")) return call_user_func_array("{$taoClass}::{$method}", $arguments);
$app->triggerError("the module {$moduleName} has no {$method} method", __FILE__, __LINE__, $exit = true);