summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-04-20 17:23:51 +0200
committeremkael <emkael@tlen.pl>2016-04-20 17:23:51 +0200
commitc7dcaab5a61e2fdb132fc48c7b92dfad89408a1f (patch)
tree9e4383afd468707d642309fb25d1618188610b47 /app
parentd923fd65d3d70f80852bb53b77f2724fecccb7d9 (diff)
* no hard-coded class names
Diffstat (limited to 'app')
-rw-r--r--app/php/db/DBConnection.php5
-rw-r--r--app/php/db/DBModule.php7
-rw-r--r--app/php/db/config.xml4
3 files changed, 6 insertions, 10 deletions
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 @@
<modules>
<module id="db"
class="Application.db.DBModule"
- config="Application.db.config" />
+ config="Application.db.config"
+ ConnectionClass="Application.db.DBConnection"
+ DbConnection.TransactionClass="Application.db.DBTransaction" />
</modules>
</configuration>