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

indexAction() public method

Shows the basket.
public indexAction ( Form $form = null ) : Response
$form Symfony\Component\DomCrawler\Form
return Symfony\Component\HttpFoundation\Response
    public function indexAction($form = null)
    {
        $form = $form ?: $this->createForm('sonata_basket_basket', $this->get('sonata.basket'), array('validation_groups' => array('elements')));
        // always validate the basket
        if (!$form->isBound()) {
            if ($violations = $this->get('validator')->validate($form)) {
                $violationMapper = new ViolationMapper();
                foreach ($violations as $violation) {
                    $violationMapper->mapViolation($violation, $form, true);
                }
            }
        }
        $this->get('session')->set('sonata_basket_delivery_redirect', 'sonata_basket_delivery_address');
        $this->get('sonata.seo.page')->setTitle($this->get('translator')->trans('basket_index_title', array(), 'SonataBasketBundle'));
        return $this->render('SonataBasketBundle:Basket:index.html.twig', array('basket' => $this->get('sonata.basket'), 'form' => $form->createView()));
    }