示例#1
0
 public static function getInstance()
 {
     if (empty(DBAdapter::$_instance)) {
         DBAdapter::$_instance = new DBAdapter();
     }
     return DBAdapter::$_instance;
 }
示例#2
0
 public function __construct()
 {
     //TODO connect db
     if (empty($this->db)) {
         $dbAdapter = \Model\DBAdapter::getInstance();
         $this->db = $dbAdapter->db;
         $this->app = $dbAdapter->getApp();
         $dbSetting = $this->app->config('dbsetting');
         $this->_name = $dbSetting['tablePrefix'] . $this->_name;
     }
     $this->setTableFields();
 }
示例#3
0
 protected function _initDB()
 {
     $dbAdapter = \Model\DBAdapter::getInstance();
     $dbAdapter->setApp($this->app);
     $dbAdapter->init();
 }