From d923fd65d3d70f80852bb53b77f2724fecccb7d9 Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 20 Apr 2016 17:17:59 +0200 Subject: * switching to namespace-based DB config path --- app/php/db/DBModule.php | 12 ++++-------- app/php/db/config.xml | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'app') 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 @@ + config="Application.db.config" /> -- cgit v1.2.3