Inheritance: extends NotFoundException
Example #1
0
 /**
  * @param CartId $cartId
  *
  * @throws CartNotFoundException
  */
 public function remove(CartId $cartId)
 {
     if (!$this->exists($cartId)) {
         throw CartNotFoundException::byId($cartId);
     }
     unset($this->carts[(string) $cartId]);
 }
Example #2
0
 /**
  * @param CartId $cartId
  * @return Cart
  * @throws CartNotFoundException
  */
 public function getById(CartId $cartId) : Cart
 {
     $cart = $this->entityManager->getRepository(Cart::class)->findOneBy(['id.id' => $cartId]);
     if ($cart === null) {
         throw CartNotFoundException::byId($cartId);
     }
     return $cart;
 }