<?php
namespace App\Controller\Website;
use App\Repository\ContactRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Twig\Environment;
class ContactController extends AbstractController
{
private $twig;
private $cp;
public function __construct(Environment $twig, ContactRepository $cp)
{
$this->twig = $twig;
$this->cp = $cp;
}
/**
* Recupere les membres d'une equipes par ID
*
* @return Response
*/
public function getContactByEntreprise(Request $req): Response
{
$request = $this->cp->getAllTeamMembers($req->query->get('id'));
$res = new Response($this->twig->render('contact/get_contact_by_entreprise.html.twig', ['request' => $request]));
return $res;
}
/**
* Recupere les acteurs territoires depuis une id territoire
*
* @return Response
*/
public function getActeurTerritoire(Request $req): Response
{
if (is_null($req->query->get('id'))) {
$users = array();
} else {
$users = $this->cp->findBy(["territoireInterv" => $req->query->get('id')]);
}
$res = new Response($this->twig->render('contact/get_acteur_territoire.html.twig', ['request' => $users]));
return $res;
}
}