Sonata\BasketBundle\Controller\BasketController::updateAction PHP Method

updateAction() public method

Update basket form rendering & saving.
public updateAction ( ) : RedirectResponse
return Symfony\Component\HttpFoundation\RedirectResponse
    public function updateAction()
    {
        $form = $this->createForm('sonata_basket_basket', $this->get('sonata.basket'), array('validation_groups' => array('elements')));
        $form->bind($this->get('request'));
        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', array('form' => $form));
    }