<?php
namespace App\Controller\Website;
use App\Repository\ContactRepository;
use App\Repository\CategoryRepository;
use Sulu\Bundle\SearchBundle\Controller\WebsiteSearchController;
use Symfony\Component\HttpFoundation\Response;
use Twig\Environment;
class TerritoireInterventionController extends WebsiteSearchController
{
private Environment $twig;
private ContactRepository $ct;
private CategoryRepository $ca;
public function __construct(Environment $twig, ContactRepository $ct, CategoryRepository $ca)
{
$this->twig = $twig;
$this->ct = $ct;
$this->ca = $ca;
}
public function getAllTerritoireAction(): Response
{
$results = $this->ca->findAll();
$response = new Response(
$this->twig->render(
'search/territoire_result.html.twig',
['results' => $results]
)
);
return $response;
}
public function getAllTerritoireUserAction(): Response
{
$results = $this->ct->findAllUniqueterritoires();
$response = new Response(
$this->twig->render(
'search/territoire_annuaire_result.html.twig',
['results' => $results]
)
);
return $response;
}
}