init
This commit is contained in:
parent
db73582407
commit
6b91f8e8bd
|
@ -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();
|
||||||
}
|
}
|
Loading…
Reference in New Issue