| Conditions | 3 |
| Paths | 5 |
| Total Lines | 14 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 4.4609 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | 1 | public function useTransaction(callable $callable) |
|
| 17 | { |
||
| 18 | 1 | $connection = Propel::getConnection(); |
|
| 19 | 1 | $connection->beginTransaction(); |
|
| 20 | |||
| 21 | try { |
||
| 22 | 1 | $callable(); |
|
| 23 | 1 | $connection->commit(); |
|
| 24 | } catch (\Exception $exception) { |
||
| 25 | $connection->rollBack(); |
||
| 26 | throw $exception; |
||
| 27 | } catch (\Throwable $throwable) { |
||
| 28 | $connection->rollBack(); |
||
| 29 | throw $throwable; |
||
| 30 | } |
||
| 32 | } |