Controller/CartController.php
public function informationsAction(Request $request)
    {
        if (null !== $redirect = $this->validateStep('information')) {
            return $redirect;
        }

        $cart = $this->getCart();

        /** @var \Ekyna\Bundle\UserBundle\Model\UserInterface $user */
        $user = $this->getUser();
        if (null !== $user) {
            $cart
                ->setUser($user)
                ->setGender($user->getGender())
                ->setFirstName($user->getFirstName())
                ->setLastName($user->getLastName())
                ->setEmail($user->getEmail())
            ;
        }

        $form = $this->createForm('ekyna_cart_step_information', $cart);

        $form->handleRequest($request);
        if ($form->isValid()) {
            $event = new OrderEvent($cart);
            $this->getDispatcher()->dispatch(OrderEvents::CONTENT_CHANGE, $event);
            if (!$event->isPropagationStopped()) {
                if ($cart->requiresShipment()) {
                    return $this->redirect($this->generateUrl('ekyna_cart_shipment'));
                }
                return $this->redirect($this->generateUrl('ekyna_cart_payment'));
            } else {
                $event->toFlashes($this->getFlashBag());
            }
            return $this->redirect($this->generateUrl('ekyna_cart_informations'));
        }

        return $this->render('EkynaCartBundle:Cart:informations.html.twig', [
            'form' => $form->createView(),
            'cart' => $cart,
         	'user' => $user,
        ]);
    }
public function informationsAction(Request $request)
    {
        if (null !== $redirect = $this->validateStep('information')) {
            return $redirect;
        }

        $cart = $this->getCart();

        /** @var \Ekyna\Bundle\UserBundle\Model\UserInterface $user */
        $user = $this->getUser();
        if (null !== $user) {
            $cart
                ->setUser($user)
                ->setGender($user->getGender())
                ->setFirstName($user->getFirstName())
                ->setLastName($user->getLastName())
                ->setEmail($user->getEmail())
            ;
        }

        $form = $this->createForm('ekyna_cart_step_information', $cart);

        $form->handleRequest($request);
        if ($form->isValid()) {
            $event = new OrderEvent($cart);
            $this->getDispatcher()->dispatch(OrderEvents::CONTENT_CHANGE, $event);
            if (!$event->isPropagationStopped()) {
                if ($cart->requiresShipment()) {
                    return $this->redirect($this->generateUrl('ekyna_cart_shipment'));
                }
                return $this->redirect($this->generateUrl('ekyna_cart_payment'));
            } else {
                $event->toFlashes($this->getFlashBag());
            }
            return $this->redirect($this->generateUrl('ekyna_cart_informations'));
        }

        return $this->render('EkynaCartBundle:Cart:informations.html.twig', [
            'form' => $form->createView(),
            'cart' => $cart,
         	'user' => $user,
        ]);
    }
public function informationsAction ( Request $ request ) { if ( null !== $ redirect = $ this -> validateStep ( 'information' ) ) { return $ redirect ; } $ cart = $ this -> getCart ( ) ; /** @var \Ekyna\Bundle\UserBundle\Model\UserInterface $user */ $ user = $ this -> getUser ( ) ; if ( null !== $ user ) { $ cart -> setUser ( $ user ) -> setGender ( $ user -> getGender ( ) ) -> setFirstName ( $ user -> getFirstName ( ) ) -> setLastName ( $ user -> getLastName ( ) ) -> setEmail ( $ user -> getEmail ( ) ) ; } $ form = $ this -> createForm ( 'ekyna_cart_step_information' , $ cart ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { $ event = new OrderEvent ( $ cart ) ; $ this -> getDispatcher ( ) -> dispatch ( OrderEvents :: CONTENT_CHANGE , $ event ) ; if ( ! $ event -> isPropagationStopped ( ) ) { if ( $ cart -> requiresShipment ( ) ) { return $ this -> redirect ( $ this -> generateUrl ( 'ekyna_cart_shipment' ) ) ; } return $ this -> redirect ( $ this -> generateUrl ( 'ekyna_cart_payment' ) ) ; } else { $ event -> toFlashes ( $ this -> getFlashBag ( ) ) ; } return $ this -> redirect ( $ this -> generateUrl ( 'ekyna_cart_informations' ) ) ; } return $ this -> render ( 'EkynaCartBundle:Cart:informations.html.twig' , [ 'form' => $ form -> createView ( ) , 'cart' => $ cart , 'user' => $ user , ] ) ; }
Informations action.

@param Request $request
@return \Symfony\Component\HttpFoundation\RedirectResponse|Response
Informations action .