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