This commit is contained in:
Michał Sieciechowicz 2021-02-28 00:47:21 +01:00
parent db73582407
commit 6b91f8e8bd
1 changed files with 6 additions and 4 deletions

View File

@ -24,7 +24,7 @@ abstract class Model {
} }
protected static function Query($sql, $params) { protected static function Query($sql, $params) {
self::Initialize(); self::Check();
return ConnectionManager::Query( return ConnectionManager::Query(
$sql, $sql,
$params, $params,
@ -32,17 +32,19 @@ abstract class Model {
} }
protected static function QueryAll($sql, $params) { protected static function QueryAll($sql, $params) {
self::Initialize(); self::Check();
return ConnectionManager::QueryAll( return ConnectionManager::QueryAll(
$sql, $sql,
$params, $params,
get_called_class()); get_called_class());
} }
abstract public static function Initialize() { public static function Check() {
if (static::$table === null) { if (static::$table === null) {
static::$table = basename(get_called_class()) . 's'; static::$table = basename(get_called_class()) . 's';
} }
static::Initialize(); static::Initialize();
} }
abstract public static function Initialize();
} }