1 | <?php |
||
15 | class TransactionalCommandLockingDecorator implements Decorator |
||
16 | { |
||
17 | use InnerBusTrait; |
||
18 | |||
19 | /** |
||
20 | * Whether or not a Command is in progress and the bus is locked |
||
21 | * @var bool |
||
22 | */ |
||
23 | protected $locked = false; |
||
24 | |||
25 | /** |
||
26 | * Queued Commands to be executed when the current command finishes |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $queue = []; |
||
30 | |||
31 | public function __construct(CommandBus $innerCommandBus = null) |
||
35 | |||
36 | /** |
||
37 | * Execute a command |
||
38 | * |
||
39 | * @param Command $command |
||
40 | * @return mixed |
||
41 | */ |
||
42 | public function execute(Command $command) |
||
59 | |||
60 | /** |
||
61 | * Execute a command, regardless of the lock |
||
62 | * |
||
63 | * @param Command $command |
||
64 | * @return mixed |
||
65 | */ |
||
66 | protected function executeIgnoringLock(Command $command) |
||
70 | |||
71 | /** |
||
72 | * Execute all queued commands |
||
73 | */ |
||
74 | protected function executeQueue() |
||
80 | } |
||
81 |