1 | <?php |
||
8 | class TransactionPDO extends PDO |
||
9 | { |
||
10 | /** |
||
11 | * @var array Database drivers that support SAVEPOINT * statements. |
||
12 | */ |
||
13 | protected static $supportedDrivers = ['pgsql', 'mysql']; |
||
14 | |||
15 | /** |
||
16 | * @var int Current transaction depth |
||
17 | */ |
||
18 | protected $transactionDepth = 0; |
||
19 | |||
20 | /** |
||
21 | * Test if database driver support savepoints |
||
22 | * |
||
23 | * @return bool |
||
24 | */ |
||
25 | protected function hasSavepoint() : bool |
||
29 | |||
30 | /** |
||
31 | * Start transaction |
||
32 | * |
||
33 | * @return bool|void |
||
34 | */ |
||
35 | public function beginTransaction() |
||
45 | |||
46 | /** |
||
47 | * Commit current transaction |
||
48 | * |
||
49 | * @return bool|void |
||
50 | */ |
||
51 | public function commit() |
||
61 | |||
62 | /** |
||
63 | * Rollback current transaction |
||
64 | * |
||
65 | * @throws \PDOException if there is no transaction started |
||
66 | * @return bool|void |
||
67 | */ |
||
68 | public function rollBack() |
||
82 | } |
||
83 |