<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\Routing\Annotation\Route;
use Doctrine\DBAL\Connection;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\FileBag;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
class HomeController extends AbstractController
{
private $connection;
public function __construct(Connection $connection)
{
$this->connection = $connection;
}
#[Route('/', name: 'app_home')]
public function index(AuthenticationUtils $authenticationUtils): Response
{
$error = $authenticationUtils->getLastAuthenticationError();
$connection = $this->connection;
$sql = "SELECT master_state_id, state_name
FROM master_state where status='1'
ORDER BY state_name";
$states = $this->connection
->executeQuery($sql)
->fetchAllAssociative();
$sql1 = "SELECT master_country_id, country_name
FROM master_country where statu_s='active'
ORDER BY country_name";
$countries = $this->connection
->executeQuery($sql1)
->fetchAllAssociative();
return $this->render('home/index.html.twig', [
'error' => $error,
'states'=>$states,
'countries'=>$countries
]);
}
}