From c7dcaab5a61e2fdb132fc48c7b92dfad89408a1f Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 20 Apr 2016 17:23:51 +0200 Subject: * no hard-coded class names --- app/php/db/DBConnection.php | 5 ----- app/php/db/DBModule.php | 7 +++---- app/php/db/config.xml | 4 +++- 3 files changed, 6 insertions(+), 10 deletions(-) (limited to 'app/php/db') diff --git a/app/php/db/DBConnection.php b/app/php/db/DBConnection.php index 4fb18c8..92ab0fb 100644 --- a/app/php/db/DBConnection.php +++ b/app/php/db/DBConnection.php @@ -5,11 +5,6 @@ Prado::using('System.Data.TDbConnection'); class DBConnection extends TDbConnection { - public function __construct($dsn = '', $username = '', $password = '', $charset = '') { - $this->setTransactionClass('Application.Code.DBTransaction'); - parent::__construct($dsn, $username, $password, $charset); - } - private $_transaction = NULL; public function getCurrentTransaction() { if (!$this->_transaction->getActive()) { diff --git a/app/php/db/DBModule.php b/app/php/db/DBModule.php index 592dc12..462b6f6 100644 --- a/app/php/db/DBModule.php +++ b/app/php/db/DBModule.php @@ -7,15 +7,14 @@ class DBModule extends TDataSourceConfig { private $_config; public function init($xml) { - $this->setConnectionClass('Application.db.DBConnection'); - $config = json_decode(file_get_contents( - Prado::getPathOfNamespace($this->_config, '.json') - )); $newXML = new TXmlElement('module'); foreach ($xml->getAttributes() as $attr => $val) { $newXML->setAttribute($attr, $val); } $dbXML = new TXmlElement('database'); + $config = json_decode(file_get_contents( + Prado::getPathOfNamespace($this->_config, '.json') + )); if (isset($config->cset)) { $dbXML->setAttribute('Charset', $config->cset); } diff --git a/app/php/db/config.xml b/app/php/db/config.xml index cf484d0..3210593 100644 --- a/app/php/db/config.xml +++ b/app/php/db/config.xml @@ -3,6 +3,8 @@ + config="Application.db.config" + ConnectionClass="Application.db.DBConnection" + DbConnection.TransactionClass="Application.db.DBTransaction" /> -- cgit v1.2.3