| 1 | <?php |
||
| 9 | class SimpleTransactionManager implements TransactionManager |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var Transactional[] |
||
| 13 | */ |
||
| 14 | private $items; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var bool |
||
| 18 | */ |
||
| 19 | private $running; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Constructor. |
||
| 23 | * |
||
| 24 | * @param Transactional[] $items |
||
| 25 | */ |
||
| 26 | 45 | public function __construct(array $items = []) |
|
| 31 | |||
| 32 | /** |
||
| 33 | * {@inheritdoc} |
||
| 34 | */ |
||
| 35 | 27 | public function addTransactionalItem(Transactional $item) |
|
| 43 | |||
| 44 | /** |
||
| 45 | * {@inheritdoc} |
||
| 46 | */ |
||
| 47 | 30 | public function beginTransaction() |
|
| 63 | |||
| 64 | /** |
||
| 65 | * {@inheritdoc} |
||
| 66 | */ |
||
| 67 | 9 | public function commit() |
|
| 77 | |||
| 78 | /** |
||
| 79 | * {@inheritdoc} |
||
| 80 | */ |
||
| 81 | 9 | public function rollback() |
|
| 91 | |||
| 92 | /** |
||
| 93 | * Check if there's a transaction running. |
||
| 94 | * |
||
| 95 | * @throws NoRunningTransactionException |
||
| 96 | */ |
||
| 97 | 18 | private function checkTransaction() |
|
| 103 | |||
| 104 | /** |
||
| 105 | * Reset the transaction. |
||
| 106 | */ |
||
| 107 | 45 | protected function reset() |
|
| 111 | } |
||
| 112 |