This commit is contained in:
2023-12-13 09:47:00 +08:00
parent 64087d6258
commit 013be605f4
2 changed files with 290 additions and 0 deletions
+19
View File
@@ -10,6 +10,7 @@ declare(strict_types=1);
namespace Database;
use Database\Base\ActiveQueryInterface;
use Exception;
defined('SAVE_FAIL') or define('SAVE_FAIL', 3227);
@@ -21,6 +22,8 @@ defined('FIND_OR_CREATE_MESSAGE') or define('FIND_OR_CREATE_MESSAGE', 'Create a
*
* @property $attributes
* @property-read $oldAttributes
*
* @mixin ActiveQueryInterface
*/
class Model extends Base\Model
{
@@ -130,6 +133,22 @@ class Model extends Base\Model
}
/**
* @param string $name
* @param array $arguments
* @return mixed
*/
public static function __callStatic(string $name, array $arguments)
{
// TODO: Change the autogenerated stub
if (method_exists(static::class, $name)) {
return call_user_func(static::class . '::' . $name, ...$arguments);
} else {
return static::query()->{$name}(...$arguments);
}
}
/**
* @param $columns
* @param $action