<?php
namespace App\Controller\Website;
use App\Repository\ContactRepository;
use Sulu\Bundle\SearchBundle\Controller\WebsiteSearchController;
use Symfony\Component\HttpFoundation\Response;
use Twig\Environment;
class DepartementController extends WebsiteSearchController
{
private Environment $twig;
private ContactRepository $ct;
public function __construct(Environment $twig, ContactRepository $ct)
{
$this->twig = $twig;
$this->ct = $ct;
}
public function getAllDepartementAction(): Response
{
$departments = $this->ct->findAllUniqueDepartments();
$response = new Response(
$this->twig->render(
'search/departement_userlist_result.html.twig',
['results' => $departments]
)
);
return $response;
}
}