src/Controller/Frontend/LoginCustomerController.php line 50

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Frontend;
  3. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  6. use App\Entity\Customer;
  7. use App\Form\CustomerLoginType;
  8. use Symfony\Component\HttpFoundation\JsonResponse;
  9. use Nzo\UrlEncryptorBundle\Annotations\ParamDecryptor;
  10. use Nzo\UrlEncryptorBundle\Annotations\ParamEncryptor;
  11. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  12. use Symfony\Component\Security\Core\Security;
  13. use App\Service\HelperService;
  14. use Symfony\Component\String\Slugger\SluggerInterface;
  15. use Nzo\UrlEncryptorBundle\Encryptor\Encryptor;
  16. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  17. class LoginCustomerController extends AbstractController
  18. {
  19.     
  20.     /**
  21.      * @Route("{slug}/customer/login", name="frontend_customer_login")
  22.      */
  23.     public function loginAction(Request $requestAuthenticationUtils $authenticationUtils$slug)
  24.     {
  25.         
  26.         $customer = new Customer();
  27.         $form $this->createForm (CustomerLoginType::class, $customer);        
  28.         
  29.         $error $authenticationUtils->getLastAuthenticationError();
  30.                 
  31.         $clientObj $this->getDoctrine()->getRepository(\App\Entity\Client::class)->findOneBy(array("slug" => $slug ));
  32.         $settings  $this->getDoctrine()->getRepository(\App\Entity\WebSetting::class)->findOneBy(array("Client" => $clientObj ));
  33.         // replace this example code with whatever you need
  34.         return $this->render('Frontend/Customer/login.html.twig', array(
  35.             "form"            => $form->createView(),
  36.             'error'           => $error,
  37.             'productCategory' => "",
  38.             'pager_limit'     => "",
  39.             'globalSearch'    => "",           
  40.             'brand'           => "",            
  41.             'category'        => "",
  42.             'settings'        => $settings,
  43.             'slug'            => $slug         
  44.         ));          
  45.             
  46.     }
  47.     /**
  48.     * @Route("{slug}/customer/logout-customer", name="frontend_logout_customer")
  49.     */
  50.     public function logoutAction(Request $request)
  51.     {    
  52.         //$session = $this->get('request')->getSession();
  53.         //$session->clear();           
  54.         //return $this->redirectToRoute("frontend_index");
  55.     }
  56.     
  57.     
  58. }