Beispiel #1
0
 public static function getInstance()
 {
     if (empty(DBAdapter::$_instance)) {
         DBAdapter::$_instance = new DBAdapter();
     }
     return DBAdapter::$_instance;
 }
Beispiel #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();
 }
Beispiel #3
0
 protected function _initDB()
 {
     $dbAdapter = \Model\DBAdapter::getInstance();
     $dbAdapter->setApp($this->app);
     $dbAdapter->init();
 }