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