30 private static $cfg = null;
44 private static $log = array();
67 $cfg = self::$cfg->get(
'defCfg');
69 if (!array_key_exists(
$cfg, self::$instances)) {
70 $tmp = self::$cfg->get(
$cfg);
71 $tmp[
'getInstanceCfg'] =
$cfg;
76 return self::$instances[
$cfg];
87 public static function get($type, $table, array $prm = array()) {
88 if ($type ==
'table' && array_key_exists($table, self::$tables))
89 return self::$tables[$table];
94 $tableName = $table->getName();
95 if (!array_key_exists(
'table', $prm))
96 $prm[
'table'] = $table;
99 if ($type ==
'table' && !array_key_exists(
'name', $prm))
100 $prm[
'name'] = $table;
101 else if ($type ==
'row' && !array_key_exists(
'table', $prm)) {
102 $db = array_key_exists(
'db', $prm)? $prm[
'db'] : self::getInstance();
103 $prm[
'table'] = self::get(
'table', $tableName, array(
'db'=>$db));
107 if (!($className = self::$cfg->getInArray($type, $tableName)) &&
109 $className = self::$cfg->get($type.
'Class');
111 if ($type ==
'table') {
113 return self::$tables[$table];
126 return self::$cfg->get($key);
136 return substr($field, 0, strlen(self::getCfg(
'i18n'))) == self::getCfg(
'i18n');
146 return self::isI18nName($field)? substr($field, strlen(self::getCfg(
'i18n'))) : $field;
156 public static function log($sql=null, $bind=null) {
159 else if (empty($bind))
162 self::$log[] = array($sql, $bind);
168 protected static function init() {
169 if (self::$cfg == null)
static unI18nName($field)
static log($sql=null, $bind=null)
static isI18nName($field)
static loadCfg($className, $searchParent=true)
static isCreable($className)
static getInstance($cfg=null)
static get($className, array $cfg=array())