Controller/Frontend/ProfileController.php
public function editProfileAction(Request $request)
    {
        $customer = $this->getUser();
        if (!is_object($customer) || !$customer instanceof Customer) {
            return $this->redirectToRoute("miky_app_customer_security_login");
        }

        $customerManager = $this->container->get('miky_customer_manager');
        $customerManager->getRepository()->findOneById($customer->getId());
        $form = $this->createForm('miky_customer_profile_front', $customer);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $user = $form->getData();
            $customerManager->updateUser($user);
        }

        return $this->render('MikyUserBundle:Profile:edit.html.twig', array(
            'form' => $form->createView(),
        ));
    }
public function editProfileAction(Request $request)
    {
        $customer = $this->getUser();
        if (!is_object($customer) || !$customer instanceof Customer) {
            return $this->redirectToRoute("miky_app_customer_security_login");
        }

        $customerManager = $this->container->get('miky_customer_manager');
        $customerManager->getRepository()->findOneById($customer->getId());
        $form = $this->createForm('miky_customer_profile_front', $customer);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $user = $form->getData();
            $customerManager->updateUser($user);
        }

        return $this->render('MikyUserBundle:Profile:edit.html.twig', array(
            'form' => $form->createView(),
        ));
    }
public function editProfileAction ( Request $ request ) { $ customer = $ this -> getUser ( ) ; if ( ! is_object ( $ customer ) || ! $ customer instanceof Customer ) { return $ this -> redirectToRoute ( "miky_app_customer_security_login" ) ; } $ customerManager = $ this -> container -> get ( 'miky_customer_manager' ) ; $ customerManager -> getRepository ( ) -> findOneById ( $ customer -> getId ( ) ) ; $ form = $ this -> createForm ( 'miky_customer_profile_front' , $ customer ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ user = $ form -> getData ( ) ; $ customerManager -> updateUser ( $ user ) ; } return $ this -> render ( 'MikyUserBundle:Profile:edit.html.twig' , array ( 'form' => $ form -> createView ( ) , ) ) ; }
@return Response|RedirectResponse

@throws AccessDeniedException
@return Response|RedirectResponse