getById() public method

public getById ( OrderId $orderId ) : Order
$orderId OrderId
return Order
示例#1
0
 /**
  * @param AcceptOrder $command
  * @throws OrderNotFoundException
  * @throws InvalidTransitionException
  */
 public function handle(AcceptOrder $command)
 {
     $order = $this->orders->getById(new OrderId($command->orderId()));
     $order->accept();
 }
示例#2
0
 /**
  * @param CreatePayment $command
  * @throws OrderNotFoundException
  */
 public function handle(CreatePayment $command)
 {
     $order = $this->orders->getById(new OrderId($command->orderId()));
     $this->payments->add(new Payment(new PaymentId($command->paymentId()), $order));
 }
示例#3
0
 /**
  * @param RefundOrder $command
  * @throws InvalidTransitionException
  * @throws OrderNotFoundException
  */
 public function handle(RefundOrder $command)
 {
     $order = $this->orders->getById(new OrderId($command->orderId()));
     $order->refund();
 }
示例#4
0
 /**
  * @param PrepareOrder $command
  * @throws InvalidTransitionException
  */
 public function handle(PrepareOrder $command)
 {
     $order = $this->orders->getById(new OrderId($command->orderId()));
     $order->prepare();
 }