1 | <?php |
||
13 | trait OrmTransaction |
||
14 | { |
||
15 | /** |
||
16 | * Include the connection related functionality |
||
17 | */ |
||
18 | use OrmConnection; |
||
19 | |||
20 | /** |
||
21 | * The stack of open transactions |
||
22 | * |
||
23 | * @var int |
||
24 | */ |
||
25 | private $transactionStack = 0; |
||
26 | |||
27 | /** |
||
28 | * Begin a new transaction |
||
29 | * |
||
30 | * @return \PDO |
||
31 | */ |
||
32 | 29 | public function startTX() |
|
44 | |||
45 | /** |
||
46 | * Try to commit the complete transaction stack |
||
47 | * |
||
48 | * @throws OrmException |
||
49 | * @throws PDOException |
||
50 | */ |
||
51 | 27 | public function commitTX() |
|
65 | |||
66 | /** |
||
67 | * Rollback the complete stack |
||
68 | * |
||
69 | * @return OrmException either previous exception or new occured during rollback containing previous |
||
70 | */ |
||
71 | 2 | public function rollBackTX(\Exception $previousException = null) |
|
95 | } |
||
96 |