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