/** * DSqlite constructor * * @param string $name * @param array $config */ public function __construct($name, array $config) { parent::__construct($name, $config); if (!$this->_connection) { $this->connect(); } }
/** * Open connect to database after model start construct * * @param null $db */ public function __construct($db = null) { if ($db) { // Set the instance or name $this->_db = $db; } elseif (!$this->_db) { // Use the default name $this->_db = Database::$default; } $config = Config::load('database', true); $this->_config = $config[$this->_db]; $this->_config['path'] = $config['path']; if (is_string($this->_db)) { // Load the database $this->db = Database::init($this->_db); } }
/** * DMongoDB constructor * * @param string $name * @param array $config */ public function __construct($name, array $config) { parent::__construct($name, $config); }