<?php
namespace App\Controller\Frontend;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use App\Entity\Customer;
use App\Form\CustomerLoginType;
use Symfony\Component\HttpFoundation\JsonResponse;
use Nzo\UrlEncryptorBundle\Annotations\ParamDecryptor;
use Nzo\UrlEncryptorBundle\Annotations\ParamEncryptor;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Security\Core\Security;
use App\Service\HelperService;
use Symfony\Component\String\Slugger\SluggerInterface;
use Nzo\UrlEncryptorBundle\Encryptor\Encryptor;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
class LoginCustomerController extends AbstractController
{
/**
* @Route("{slug}/customer/login", name="frontend_customer_login")
*/
public function loginAction(Request $request, AuthenticationUtils $authenticationUtils, $slug)
{
$customer = new Customer();
$form = $this->createForm (CustomerLoginType::class, $customer);
$error = $authenticationUtils->getLastAuthenticationError();
$clientObj = $this->getDoctrine()->getRepository(\App\Entity\Client::class)->findOneBy(array("slug" => $slug ));
$settings = $this->getDoctrine()->getRepository(\App\Entity\WebSetting::class)->findOneBy(array("Client" => $clientObj ));
// replace this example code with whatever you need
return $this->render('Frontend/Customer/login.html.twig', array(
"form" => $form->createView(),
'error' => $error,
'productCategory' => "",
'pager_limit' => "",
'globalSearch' => "",
'brand' => "",
'category' => "",
'settings' => $settings,
'slug' => $slug
));
}
/**
* @Route("{slug}/customer/logout-customer", name="frontend_logout_customer")
*/
public function logoutAction(Request $request)
{
//$session = $this->get('request')->getSession();
//$session->clear();
//return $this->redirectToRoute("frontend_index");
}
}