<?php
namespace App\Controller;
use App\Repository\AboutRepository;
use App\Repository\HeaderRepository;
use App\Repository\LangAreaRepository;
use App\Repository\SectionTitleRepository;
use App\Repository\ServicesRepository;
use App\Repository\TeamsRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class MainController extends AbstractController
{
/**
* @Route("/{_locale<%app.supported_locales%>}/", name="app_main")
*/
public function index(HeaderRepository $headerRepository, SectionTitleRepository $titleRepository,
LangAreaRepository $areaRepository, AboutRepository $aboutRepository, TeamsRepository $teamsRepository, ServicesRepository $servicesRepository): Response
{
$header = $headerRepository->findByIsActive(1);
$lang = $areaRepository->findByIsActive(1);
$team = $teamsRepository->findByIsActive(1);
$about = $aboutRepository->findAboutPostByTag('about_index');
$service = $titleRepository->findTitleByTag('services_home');
$service = $titleRepository->findTitleByTag('services_home');
$homeservices = $servicesRepository->findByIsHome(1);
$traduction = $servicesRepository->findServicesByTag('tradcution_index');
return $this->render('main/index.html.twig', [
'headers' => $header,
'langs' => $lang,
'abouts' => $about,
'teams' => $team,
'servicesTitle' => $service,
'services' => $homeservices,
'translation' => $traduction
]);
}
/**
* @Route("/")
*/
public function indexNoLocal(): Response
{
return $this->redirectToRoute('app_main', ['_locale' => 'fr']);
}
}