Elcodi\Store\UserBundle\Controller\SecurityController::registerAction PHP Méthode

registerAction() public méthode

Register page
public registerAction ( Elcodi\Component\User\Entity\Interfaces\CustomerInterface $customer, Symfony\Component\Form\FormView $registerFormView, boolean $isValid ) : Response
$customer Elcodi\Component\User\Entity\Interfaces\CustomerInterface empty customer
$registerFormView Symfony\Component\Form\FormView Register form type
$isValid boolean Form submition is valid
Résultat Symfony\Component\HttpFoundation\Response Response
    public function registerAction(CustomerInterface $customer, FormView $registerFormView, $isValid)
    {
        /**
         * If user is already logged, go to redirect url
         */
        $authorizationChecker = $this->get('security.authorization_checker');
        if ($authorizationChecker->isGranted('ROLE_CUSTOMER')) {
            return $this->redirectToRoute('store_homepage');
        }
        if ($isValid) {
            $customerManager = $this->get('elcodi.object_manager.customer');
            $customerManager->persist($customer);
            $customerManager->flush($customer);
            $this->get('elcodi.manager.customer')->register($customer);
            return $this->redirectToRoute('store_homepage');
        }
        return $this->renderTemplate('Pages:user-register.html.twig', ['form' => $registerFormView]);
    }