summaryrefslogtreecommitdiff
path: root/framework/Data
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Data')
-rw-r--r--framework/Data/ActiveRecord/TActiveRecordConfig.php2
-rw-r--r--framework/Data/TDataSourceConfig.php21
2 files changed, 17 insertions, 6 deletions
diff --git a/framework/Data/ActiveRecord/TActiveRecordConfig.php b/framework/Data/ActiveRecord/TActiveRecordConfig.php
index fb57fd33..51278fc9 100644
--- a/framework/Data/ActiveRecord/TActiveRecordConfig.php
+++ b/framework/Data/ActiveRecord/TActiveRecordConfig.php
@@ -134,4 +134,4 @@ class TActiveRecordConfig extends TDataSourceConfig
{
$this->_invalidFinderResult = TPropertyValue::ensureEnum($value, 'TActiveRecordInvalidFinderResult');
}
-} \ No newline at end of file
+}
diff --git a/framework/Data/TDataSourceConfig.php b/framework/Data/TDataSourceConfig.php
index 53a5ef22..cf1f963c 100644
--- a/framework/Data/TDataSourceConfig.php
+++ b/framework/Data/TDataSourceConfig.php
@@ -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,4 +165,3 @@ class TDataSourceConfig extends TModule
throw new TConfigurationException('datasource_dbconnection_invalid',$id);
}
}
-