diff options
author | emkael <emkael@tlen.pl> | 2016-04-20 17:17:59 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-04-20 17:17:59 +0200 |
commit | d923fd65d3d70f80852bb53b77f2724fecccb7d9 (patch) | |
tree | 4bc026cf8ec14b1ec1bab5ab916edb374f19f7dd /app | |
parent | 4e9251ea265a24e749b7756da2585663e8f85232 (diff) |
* switching to namespace-based DB config path
Diffstat (limited to 'app')
-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> |