コード例 #1
0
 /**
  * makeConfig Wrap the associative configuration array inside a DBConfig class
  * 
  * @access public
  * @return void
  * @note the Database configuration should be of the following format:
  *  mixed[] $configuration {
  *     @type string "type" Database type as used in PDO DSN
  *     @type string "host" Database host
  *     @type string "host" Database port
  *     @type integer "name" Database name
  *     @type boolean "username" Database username
  *     @type string "password" Database password
  * }
  */
 protected function makeConfig()
 {
     $this->_checkConfig();
     // Construct the DBConfig object
     $dbConfig = new DBConfig();
     $dbConfig->setName($this->_config['name']);
     $dbConfig->setType($this->_config['type']);
     $dbConfig->setHost($this->_config['host']);
     if (isset($this->_config['port'])) {
         $dbConfig->setPort($this->_config['port']);
     }
     $dbConfig->setUser($this->_config['user']);
     $dbConfig->setPassword($this->_config['password']);
     return $dbConfig;
 }