/** * Database constructor * * @param mixed $mConfig - config array or name of config * @return void */ private function __construct($mConfig) { // get Lithium instance if (!$this->oLithium instanceof Lithium) { $this->oLithium = Lithium::getInstance(); } if (empty($mConfig)) { // load default db config $this->loadConfig($this->oLithium->getConfig('database'), 'default'); } elseif (is_array($mConfig)) { $this->loadConfig($mConfig, 'default'); } elseif (is_string($mConfig)) { // load specified db config $this->loadConfig($this->oLithium->getConfig('database'), $mConfig); } if (empty($this->aConfig)) { throw new Lithium_Exception_Database('database.error_config'); } // get driver name $sDriver = $this->getDriverName(); // load driver $this->oDriver = new $sDriver($this->aConfig); // clean pass field $this->aConfig['pass'] = ''; }