示例#1
0
 public function handleReservationRejected(ReservationRejected $event, State $state)
 {
     // the seat reservation for the given order is has been rejected, reject the order as well
     $command = new RejectOrder($state->get('orderId'));
     $this->commandBus->dispatch($command);
     // the saga ends here
     $state->setDone();
     return $state;
 }
 public function handle($event, State $state = null)
 {
     $this->isCalled = true;
     if ($event instanceof TestEvent1) {
         $state->set('event', 'testevent1');
     } elseif ($event instanceof TestEvent2) {
         $state->set('event', 'testevent2');
     } elseif ($event instanceof TestEventDone) {
         $state->setDone();
     }
     return $state;
 }