original_string: public function saveAction(Request $request)
      {
          $cart = $this->getCurrentCart();
          $form = $this->createForm(CartType::class, $cart);
  
          if ($form->handleRequest($request)->isValid()) {
              
              $em = $this->getDoctrine()->getManager();
              $em->persist($cart);
              $em->flush();
              
              return $this->redirect($this->generateUrl('ecommerce_checkout_identification'));
              
  //            $event = new CartEvent($cart);
  //            $event->isFresh(true);
  //
  //            // Update models
  //            $this->dispatchEvent(SyliusCartEvents::CART_SAVE_INITIALIZE, $event);
  //
  //            // Write flash message
  //            $this->dispatchEvent(SyliusCartEvents::CART_SAVE_COMPLETED, new FlashEvent());
          }
  
          return array(
              'cart' => $cart,
              'form' => $form->createView()
          );
      }
code: public function saveAction(Request $request)
      {
          $cart = $this->getCurrentCart();
          $form = $this->createForm(CartType::class, $cart);
  
          if ($form->handleRequest($request)->isValid()) {
              
              $em = $this->getDoctrine()->getManager();
              $em->persist($cart);
              $em->flush();
              
              return $this->redirect($this->generateUrl('ecommerce_checkout_identification'));
              
  //            $event = new CartEvent($cart);
  //            $event->isFresh(true);
  //
  //            // Update models
  //            $this->dispatchEvent(SyliusCartEvents::CART_SAVE_INITIALIZE, $event);
  //
  //            // Write flash message
  //            $this->dispatchEvent(SyliusCartEvents::CART_SAVE_COMPLETED, new FlashEvent());
          }
  
          return array(
              'cart' => $cart,
              'form' => $form->createView()
          );
      }
code_tokens: public function saveAction ( Request $ request ) { $ cart = $ this -> getCurrentCart ( ) ; $ form = $ this -> createForm ( CartType :: class , $ cart ) ; if ( $ form -> handleRequest ( $ request ) -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ cart ) ; $ em -> flush ( ) ; return $ this -> redirect ( $ this -> generateUrl ( 'ecommerce_checkout_identification' ) ) ; //            $event = new CartEvent($cart); //            $event->isFresh(true); // //            // Update models //            $this->dispatchEvent(SyliusCartEvents::CART_SAVE_INITIALIZE, $event); // //            // Write flash message //            $this->dispatchEvent(SyliusCartEvents::CART_SAVE_COMPLETED, new FlashEvent()); } return array ( 'cart' => $ cart , 'form' => $ form -> createView ( ) ) ; }
docstring: This action is used to submit the cart summary form.
  If the form and updated cart are valid, it refreshes
  the cart data and saves it using the operator.
  
  If there are any errors, it displays the cart detail page.
  
  @param Request $request
  @return Response
  
  @Route("/cart/save")
  @Template("EcommerceBundle:Front:detail.html.twig")
docstring_tokens: This action is used to submit the cart summary form . If the form and updated cart are valid it refreshes the cart data and saves it using the operator .