示例#1
0
 public function __construct()
 {
     parent::__construct(\Path::instance()->currentProject('*****@*****.**'));
     $this->collection = new \DB\Config();
     $config = $this->dom;
     $connection_nodes = $config->getElementsByTagNameNS('http://lab.zigmoyd.net/xmlns/bong', 'connection');
     $connections = array();
     foreach ($connection_nodes as $connection_node) {
         /*{ Connection attributes*/
         $name = $connection_node->getAttribute('name');
         $dsn = $connection_node->getAttribute('dsn');
         $user = $connection_node->getAttribute('user');
         $pass = $connection_node->getAttribute('pass');
         $connection = new \DB\Connection($name, $dsn, $user, $pass);
         /*}*/
         /*{ PDO Params*/
         $params = array();
         $param_nodes = $connection_node->getElementsByTagNameNS('http://lab.zigmoyd.net/xmlns/bong', 'param');
         foreach ($param_nodes as $param_node) {
             $name = $param_node->getAttribute('name');
             $value = $param_node->getAttribute('value');
             $param = new \DB\ConnectionParam($name, $value);
             $connection->addParam($param);
         }
         /*}*/
         $this->collection->addConnection($connection);
     }
     $model_nodes = $config->getElementsByTagNameNS('http://lab.zigmoyd.net/xmlns/bong', 'model');
     $model_node = $model_nodes->item(0);
     $default_connection = $model_node->getAttribute('default');
     $autoconnect = constant($model_node->getAttribute('autoconnect'));
     $this->collection->setDefault($default_connection);
     $this->collection->setAutoconnect($autoconnect);
     //echo ">> DatabaseConfig::__construct()\n";
 }
示例#2
0
文件: conf.php 项目: neel/bong
 public function __construct()
 {
     parent::__construct(rtrim(getcwd(), "/") . "/etc/common.xml");
 }
示例#3
0
文件: moduleconf.php 项目: neel/bong
 public function __construct($moduleConfPath)
 {
     parent::__construct($moduleConfPath);
 }
示例#4
0
文件: path.php 项目: neel/bong
 /**
  * @return Path
  */
 public static function instance()
 {
     return parent::instance();
 }