| 1 | <?php |
||
| 14 | class TransactionalCommandBus |
||
| 15 | { |
||
| 16 | /** @var CommandBus */ |
||
| 17 | private $decorated; |
||
| 18 | /** @var TransactionManager */ |
||
| 19 | private $transactionManager; |
||
| 20 | /** @var LoggerInterface */ |
||
| 21 | private $logger; |
||
| 22 | |||
| 23 | 12 | public function __construct(CommandBus $bus, TransactionManager $transactionManager, LoggerInterface $logger) |
|
| 29 | |||
| 30 | /** |
||
| 31 | * @param mixed $command |
||
| 32 | * |
||
| 33 | * @throws Throwable |
||
| 34 | */ |
||
| 35 | 9 | public function dispatch($command) |
|
| 47 | |||
| 48 | /** |
||
| 49 | * @param CommandHandler $handler |
||
| 50 | */ |
||
| 51 | 3 | public function subscribe(CommandHandler $handler) |
|
| 55 | |||
| 56 | /** |
||
| 57 | * @param $exception |
||
| 58 | * |
||
| 59 | * @throws Exception |
||
| 60 | */ |
||
| 61 | 6 | private function rollback($exception) |
|
| 70 | } |