| @@ 28-38 (lines=11) @@ | ||
| 25 | * @param Command $command |
|
| 26 | * @param callable|null $next |
|
| 27 | */ |
|
| 28 | public function __invoke(Command $command, callable $next = null) |
|
| 29 | { |
|
| 30 | try { |
|
| 31 | $this->pdo->beginTransaction(); |
|
| 32 | $next($command); |
|
| 33 | $this->pdo->commit(); |
|
| 34 | } catch (\PDOException $exception) { |
|
| 35 | $this->pdo->rollBack(); |
|
| 36 | throw $exception; |
|
| 37 | } |
|
| 38 | } |
|
| 39 | } |
|
| 40 | ||
| @@ 31-41 (lines=11) @@ | ||
| 28 | * @param Event $event |
|
| 29 | * @param callable|null $next |
|
| 30 | */ |
|
| 31 | public function __invoke(Event $event, callable $next = null) |
|
| 32 | { |
|
| 33 | try { |
|
| 34 | $this->pdo->beginTransaction(); |
|
| 35 | $next($event); |
|
| 36 | $this->pdo->commit(); |
|
| 37 | } catch (\PDOException $exception) { |
|
| 38 | $this->pdo->rollBack(); |
|
| 39 | throw $exception; |
|
| 40 | } |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||