From 439b0b12dc8f6cbeb769fe4f2c0061ff9d3c9d31 Mon Sep 17 00:00:00 2001 From: carlgmathisen <> Date: Tue, 2 Dec 2008 00:02:51 +0000 Subject: php configuration type --- framework/Data/TDataSourceConfig.php | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'framework/Data/TDataSourceConfig.php') 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 @@ - * @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); } } - -?> + +?> -- cgit v1.2.3