public function updateAction()
    {
        $form = $this->createForm(BasketType::class, $this->get('sonata.basket'), ['validation_groups' => ['elements']]);
        $form->handleRequest($this->getCurrentRequest());

        if ($form->isValid()) {
            $basket = $form->getData();
            $basket->reset(false); // remove delivery and payment information
            $basket->clean(); // clean the basket

            // update the basket
            $this->get('sonata.basket.factory')->save($basket);

            return new RedirectResponse($this->generateUrl('sonata_basket_index'));
        }

        return $this->forward('SonataBasketBundle:Basket:index', [
            'form' => $form,
        ]);
    }
public function updateAction()
    {
        $form = $this->createForm(BasketType::class, $this->get('sonata.basket'), ['validation_groups' => ['elements']]);
        $form->handleRequest($this->getCurrentRequest());

        if ($form->isValid()) {
            $basket = $form->getData();
            $basket->reset(false); // remove delivery and payment information
            $basket->clean(); // clean the basket

            // update the basket
            $this->get('sonata.basket.factory')->save($basket);

            return new RedirectResponse($this->generateUrl('sonata_basket_index'));
        }

        return $this->forward('SonataBasketBundle:Basket:index', [
            'form' => $form,
        ]);
    }
public function updateAction ( ) { $ form = $ this -> createForm ( BasketType :: class , $ this -> get ( 'sonata.basket' ) , [ 'validation_groups' => [ 'elements' ] ] ) ; $ form -> handleRequest ( $ this -> getCurrentRequest ( ) ) ; if ( $ form -> isValid ( ) ) { $ basket = $ form -> getData ( ) ; $ basket -> reset ( false ) ; // remove delivery and payment information $ basket -> clean ( ) ; // clean the basket // update the basket $ this -> get ( 'sonata.basket.factory' ) -> save ( $ basket ) ; return new RedirectResponse ( $ this -> generateUrl ( 'sonata_basket_index' ) ) ; } return $ this -> forward ( 'SonataBasketBundle:Basket:index' , [ 'form' => $ form , ] ) ; }
Update basket form rendering & saving.

@return RedirectResponse|Response
Update basket form rendering & saving .