diff options
Diffstat (limited to 'app/php/db')
-rw-r--r-- | app/php/db/DBModule.php | 12 | ||||
-rw-r--r-- | app/php/db/config.xml | 2 |
2 files changed, 5 insertions, 9 deletions
diff --git a/app/php/db/DBModule.php b/app/php/db/DBModule.php index 3622db0..592dc12 100644 --- a/app/php/db/DBModule.php +++ b/app/php/db/DBModule.php @@ -5,15 +5,11 @@ Prado::using('System.Data.TDataSourceConfig'); class DBModule extends TDataSourceConfig { private $_config; - + public function init($xml) { $this->setConnectionClass('Application.db.DBConnection'); $config = json_decode(file_get_contents( - realpath( - $this->getApplication()->getBasePath() - . DIRECTORY_SEPARATOR - . $this->_config - ) + Prado::getPathOfNamespace($this->_config, '.json') )); $newXML = new TXmlElement('module'); foreach ($xml->getAttributes() as $attr => $val) { @@ -35,11 +31,11 @@ class DBModule extends TDataSourceConfig { $newXML->Elements[] = $dbXML; parent::init($newXML); } - + public function setConfig($config) { $this->_config = TPropertyValue::ensureString($config); } - + } ?> diff --git a/app/php/db/config.xml b/app/php/db/config.xml index 20b1c4c..cf484d0 100644 --- a/app/php/db/config.xml +++ b/app/php/db/config.xml @@ -3,6 +3,6 @@ <modules> <module id="db" class="Application.db.DBModule" - config="db/config.json" /> + config="Application.db.config" /> </modules> </configuration> |