@param CartId $cartId

@return Cart

@throws CartNotFoundException
336430
public function getById(CartId $cartId) : Cart
    {
        if (!array_key_exists((string) $cartId, $this->carts)) {
            throw CartNotFoundException::byId($cartId);
        }

        return $this->carts[(string) $cartId];
    }
183446
public function get($rowId)
    {
        $content = $this->getContent();

        if ( ! $content->has($rowId))
            throw new InvalidRowIDException("The cart does not contain rowId {$rowId}.");

        return $content->get($rowId);
    }
564196
public static function get($transactionId)
    {
        $api = new Api\Info();
        $api->setTransactionId($transactionId);
        $result = $api->doRequest();

        $result['transactionId'] = $transactionId;

        return new Result\Transaction($result);
    }
70935
public function toWishlist($cart_id)
    {
        $result = null;
        $this->hook->attach('cart.move.wishlist.before', $cart_id, $result, $this);

        if (isset($result)) {
            return (array) $result;
        }

        $cart = $this->cart->get($cart_id);

        if (empty($cart) || !$this->cart->delete($cart_id)) {
            return $this->getResultError();
        }

        $result = $this->addToWishlist($cart);

        gplcart_static_clear();

        $this->hook->attach('cart.move.wishlist.after', $data, $result, $this);
        return (array) $result;
    }
576357
public OvhItem cart_cartId_item_itemId_GET(String cartId, Long itemId) throws IOException {
		String qPath = "/order/cart/{cartId}/item/{itemId}";
		StringBuilder sb = path(qPath, cartId, itemId);
		String resp = execN(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhItem.class);
	}
808463
public function add($id, $name = null, $qty = null, $price = null, array $options = [])
    {
        if ($this->isMulti($id)) {
            return array_map(function ($item) {
                return $this->add($item);
            }, $id);
        }

        $cartItem = $this->createCartItem($id, $name, $qty, $price, $options);

        $content = $this->getContent();

        if ($content->has($cartItem->rowId)) {
            $cartItem->qty += $content->get($cartItem->rowId)->qty;
        }

        $content->put($cartItem->rowId, $cartItem);
        
        $this->events->fire('cart.added', $cartItem);

        $this->session->put($this->instance, $content);

        return $cartItem;
    }
815867
protected function getEntity($entityId)
    {
        $entity = $this->getRepository()->get($entityId);
        if (!$entity instanceof EntityInterface) {
            throw new EntityNotFoundException(
                "There are no entities with provided entity ID."
            );
        }
        return $entity;
    }
1159303
public function findCouponsByCart(CartInterface $cart)
    {
        $cartCoupons = $this
            ->createQueryBuilder('cc')
            ->where('cc.cart = :cart')
            ->setParameter('cart', $cart)
            ->getQuery()
            ->getResult();

        return array_map(function (CartCouponInterface $cartCoupon) {
            return $cartCoupon->getCoupon();
        }, $cartCoupons);
    }
121647
public function getById(OrderId $orderId) : Order
    {
        if (!array_key_exists((string)$orderId, $this->orders)) {
            throw OrderNotFoundException::byId($orderId);
        }

        return $this->orders[(string)$orderId];
    }
1318232
public function setCarteira($carteira)
    {
        if (!in_array($carteira, $this->getCarteiras())) {
            throw new \Exception("Carteira não disponível!");
        }
        $this->carteira = $carteira;

        return $this;
    }
849550
public function fetchProduct($productId)
    {
        /** @var ProductInterface $product */
        $product = $this->getProductRepository()->find($productId);
        if (!$product) {
            throw new EntityNotFoundException($this->getProductRepository()->getClassName(), $productId);
        }

        return $product;
    }
1038939
public function get($serviceId)
    {
        if (!$this->has($serviceId)) {
            throw NotFoundException::constructWithThingNotFound($serviceId);
        }
        return $this->symfonyServiceContainer->get($serviceId);
    }
369498
public function getCdnUrl($storeId = null)
    {
        //Check for sandbox mode
        if ($this->isSandboxModeSet($storeId)) {
            return self::CDN_URL_SANDBOX;
        } else {
            return self::CDN_URL_PRODUCTION;
        }
    }
711625
public function removeCartItem($cartItemId)
    {
        $items = collect(session($this->itemsKey));

        $items = $items->reject(function ($item) use ($cartItemId) {
            return $item['id'] == $cartItemId;
        });

        session([$this->itemsKey => $items]);
    }
517654
public function dispatchCartLineOnRemoveEvent(
        CartInterface $cart,
        CartLineInterface $cartLine
    ) {
        $this->eventDispatcher->dispatch(
            ElcodiCartEvents::CARTLINE_ONREMOVE,
            new CartLineOnAddEvent(
                $cart,
                $cartLine
            )
        );

        return $this;
    }
444665
public function newAction($categoryId)
    {
        $em = $this->getDoctrine()->getManager();

        /** @var Category $category */
        $category = $em->getRepository('EcommerceBundle:Category')->find($categoryId);

        if (!$category) {
            throw $this->createNotFoundException('Unable to find Category entity.');
        }

        $entity = new Category();
        $form   = $this->createForm(new SubcategoryType(), $entity);

        return array(
            'entity' => $entity,
            'category' => $category,
            'form'   => $form->createView(),
        );
    }
644324
public function setSessionCart(Cart $cart = null)
    {
        if (null === $cart || $cart->isNew()) {
            self::$transientCart = $cart;
            $this->remove("thelia.cart_id");
        } else {
            self::$transientCart = null;
            $this->set("thelia.cart_id", $cart->getId());
        }

        return $this;
    }