summaryrefslogtreecommitdiff
path: root/app/frontend/db/DBConnection.php
blob: 92ab0fbfe0752a479c7b69af12e5aa13e30caf6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

Prado::using('Application.db.DBTransaction');
Prado::using('System.Data.TDbConnection');

class DBConnection extends TDbConnection {

    private $_transaction = NULL;
    public function getCurrentTransaction() {
        if (!$this->_transaction->getActive()) {
            $this->_transaction = NULL;
        }
        return $this->_transaction;
    }

    public function beginTransaction() {
        if ($this->_transaction && $this->_transaction->getActive()) {
            $this->_transaction->beginNestedTransaction();
        }
        else {
            $this->_transaction = parent::beginTransaction();
        }
        return $this->_transaction;
    }

}

?>