diff options
Diffstat (limited to 'framework/Data/TDataSourceConfig.php')
-rw-r--r-- | framework/Data/TDataSourceConfig.php | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/framework/Data/TDataSourceConfig.php b/framework/Data/TDataSourceConfig.php index a02c68a1..804ea848 100644 --- a/framework/Data/TDataSourceConfig.php +++ b/framework/Data/TDataSourceConfig.php @@ -1,10 +1,10 @@ -<?php +<?php
/**
* TDataSourceConfig class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @link http://www.pradosoft.com/
- * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Data
@@ -58,11 +58,23 @@ class TDataSourceConfig extends TModule */
public function init($xml)
{
- if($prop=$xml->getElementByTagName('database'))
+ if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
{
- $db=$this->getDbConnection();
- foreach($prop->getAttributes() as $name=>$value)
- $db->setSubproperty($name,$value);
+ if(isset($xml['database']) && is_array($xml['database']))
+ {
+ $db=$this->getDbConnection();
+ foreach($xml['database'] as $name=>$value)
+ $db->setSubProperty($name,$value);
+ }
+ }
+ else
+ {
+ if($prop=$xml->getElementByTagName('database'))
+ {
+ $db=$this->getDbConnection();
+ foreach($prop->getAttributes() as $name=>$value)
+ $db->setSubproperty($name,$value);
+ }
}
}
@@ -153,5 +165,5 @@ class TDataSourceConfig extends TModule throw new TConfigurationException('datasource_dbconnection_invalid',$id);
}
}
- -?> +
+?>
|