/**
  * Cart view
  *
  * @param FormType      $formType Form type
  * @param CartInterface $cart     Cart
  *
  * @return array
  *
  * @AnnotationEntity(
  *      class = {
  *          "factory" = "elcodi.cart_wrapper",
  *          "method" = "loadCart",
  *          "static" = false,
  *      },
  *      name = "cart"
  * )
  * @AnnotationForm(
  *      class = "store_cart_form_type_cart",
  *      name  = "formView",
  *      entity = "cart",
  * )
  */
 public function viewAction(FormType $formType, CartInterface $cart)
 {
     $relatedProducts = [];
     if ($cart->getCartLines()->count()) {
         $relatedProducts = $this->get('store.product.service.product_collection_provider')->getRelatedProducts($cart->getCartLines()->first()->getProduct(), 3);
     }
     /**
      * Let's sort the cartLines if needed
      */
     $cart->setCartLines($this->get('elcodi.cart_lines_sorter')->sortCartLines($cart->getCartLines()));
     $cartCoupons = $this->get('elcodi.cart_coupon_manager')->getCartCoupons($cart);
     $formView = $this->get('form.factory')->create($formType, $cart)->createView();
     return $this->render('StoreCartBundle:Cart:view.html.twig', ['cart' => $cart, 'cartcoupon' => $cartCoupons, 'form' => $formView, 'related_products' => $relatedProducts]);
 }