src/Controller/HomeController.php line 367
<?php
namespace App\Controller;
use App\Entity\User;
use App\Entity\Message;
use App\Entity\Materiel;
use App\Form\CompteType;
use App\Entity\Protocole;
use App\Form\MessageType;
use App\Entity\Commentaire;
use App\Form\CommentaireType;
use Symfony\Component\Mime\Email;
use App\Repository\PageRepository;
use App\Repository\UserRepository;
use App\Repository\SliderRepository;
use App\Repository\ArticleRepository;
use App\Repository\LogPageRepository;
use App\Repository\ContactsRepository;
use App\Repository\MaterielRepository;
use App\Repository\CategorieRepository;
use App\Repository\ProtocoleRepository;
use Doctrine\ORM\EntityManagerInterface;
use App\Repository\CommentaireRepository;
use App\Repository\MaterielphotoRepository;
use App\Repository\ProtocolephotoRepository;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Validator\Constraints\Length;
class HomeController extends AbstractController
{
/** UTILISATEUR CONNECTE */
private UserRepository $userRepository;
public function __construct(UserRepository $userRepository) {
$this->userRepository = $userRepository;
}
private function getUserEntity() : ?User {
$user = $this->getUser();
if($user == null) return null;
$email = $user->getUserIdentifier();
return $this->userRepository->findOneBy(["email" => $email]);
}
#[Route('/', name: 'home_page')]
public function index(PageRepository $pageRepository,
ArticleRepository $articleRepository,
CategorieRepository $categorieRepository,
ProtocoleRepository $protocoleRepository,
SliderRepository $sliderRepository,
LogPageRepository $logPageRepository): Response
{
$page1 = $pageRepository->findOneBy([ 'url' => 'pourquoi-nos-protocoles']);
$page2 = $pageRepository->findOneBy([ 'url' => 'organisation-du-cabinet']);
$page3 = $pageRepository->findOneBy([ 'url' => 'la-bonne-selection-du-materiel']);
$articles = $articleRepository->findBy([], ['dtpubli' => 'desc'], 4);
$categories = $categorieRepository->findOneBy(['titre' => 'Protocoles'])->getCategories();
$protocoles = $protocoleRepository->findBy(['favori' => '1'], ['titre' => 'asc']);
$logPageRepository->addLog("accueil", "/", $this->getUser());
return $this->render('home/index.html.twig', [
'page1'=> $page1,
'page2'=> $page2,
'page3'=> $page3,
'articles'=> $articles,
'categories'=> $categories,
'protocoles'=> $protocoles,
'sliders' => $sliderRepository->findAll(),
]);
}
#[Route('/sousmenus/{code}', name: 'sousmenus_menu')]
public function getsousmenus($code, CategorieRepository $categorieRepository): Response
{
switch($code) {
case 'protocoles':
return $this->render('menu/sousmenus.html.twig', [
'categorie' => $categorieRepository->findOneBy(['titre' => 'Protocoles']),
'type' => 1,
]);
case 'materiels':
return $this->render('menu/sousmenus.html.twig', [
'categorie' => $categorieRepository->findOneBy(['titre' => 'Matériels']),
'type' => 2,
]);
default :
return new Response('');
}
}
/***********************************************************************************************
* PAGES STATIQUES, ARTICLE et CONTACTS
*/
#[Route('/page/{url}', name: 'static_page')]
public function staticpage($url, PageRepository $pageRepository, LogPageRepository $logPageRepository): Response
{
$page = $pageRepository->findOneBy([ 'url' => $url]);
if($page == null) {
return $this->redirectToRoute('home_page');
}
$logPageRepository->addLog($url, "/page/".$url, $this->getUser());
return $this->render('home/pagestatic.html.twig', [
'page'=> $page
]);
}
#[Route("/articles", name:"articles_page")]
public function articlespage(ArticleRepository $articleRepository, LogPageRepository $logPageRepository): Response
{
$articles = $articleRepository->findBy([], [ 'dtpubli' => 'desc']);
return $this->render('home/pagearticles.html.twig', [
'articles'=> $articles
]);
}
#[Route("/article/{url}", name:"article_page")]
public function articlepage($url, ArticleRepository $articleRepository, LogPageRepository $logPageRepository): Response
{
$article = $articleRepository->findOneBy([ 'url' => $url]);
if($article == null) {
return $this->redirectToRoute('home_page');
}
$logPageRepository->addLog($url, "/article/".$url, $this->getUser());
return $this->render('home/pagearticle.html.twig', [
'article'=> $article
]);
}
#[Route("/contacts", name:"contacts_page")]
public function contactspage(Request $request, MailerInterface $mailer,
ContactsRepository $contactsRepository,
LogPageRepository $logPageRepository,
EntityManagerInterface $entityManager): Response
{
//les infos
$contactmessage = $contactsRepository->findOneBy(['type' => 'message']);
$liens = $contactsRepository->findBy(['type' => 'lien']);
$admins = $contactsRepository->findBy(['type' => 'admin']);
//le message
$message = new Message();
$form = $this->createForm(MessageType::class, $message);
$msgretour ="";
$form->handleRequest($request);
if($form->isSubmitted() && $form->isValid()){
$message = $form->getData();
$entityManager->persist($message);
$entityManager->flush();
//envoi de l'email
$body = 'Message de '.$message->getNom().' <br/>Email : '.$message->getEmail().' <br/>'.$message->getMessage();
//$adresse = $contactmessage->getAdresse();
$adresse = "nadine@aesisoft.fr";
$email = (new Email())
->from('website@lodeao.com')
->to($adresse)
->subject('LODEAO : '.$message->getObjet())
->text($body)
->html($body);
$mailer->send($email);
$msgretour ="Votre message a été envoyé. Merci.";
//reset du message
$message = new Message();
$form = $this->createForm(MessageType::class, $message);
}
$logPageRepository->addLog("contacts", "/contacts", $this->getUser());
return $this->render('home/contacts.html.twig', [
'form' => $form->createView(),
'contactmessage' => $contactmessage,
'msgretour' => $msgretour,
'liens' => $liens,
'admins' => $admins,
]);
}
/***********************************************************************************************
* CATEGORIE, URGENCES, MATERIEL et PROTOCOLE
*/
#[Route("/categoriefiltre/{type}/{code}/{coche}", name:"categoriefiltre_page", defaults: ["code"=> "", "coche"=> ""])]
public function categoriefiltrepage($type, $code, $coche,
ProtocoleRepository $protocoleRepository,
MaterielRepository $materielRepository,
CategorieRepository $categorieRepository,
ProtocolephotoRepository $protocolephotoRepository,
MaterielphotoRepository $materielphotoRepository,
LogPageRepository $logPageRepository): Response
{
$titre="";
$soustitre="";
$description="";
$protocoles = [];
$photos = [];
$materiels = [];
$sscategories = [];
$parentid=0;
if($code=='U') $code=34;
if($type == 1) {
$titre="Protocoles";
if(is_numeric($code) && $code != '1') {
$catid = intval($code);
$categfiltre = $categorieRepository->find($catid);
if($categfiltre != null &&$categfiltre->getParent() != null) {
$parentid=$categfiltre->getParent()->getId();
if($parentid >2 ) {
$parentid=$categfiltre->getParent()->getParent()->getId();
if($parentid <3 ) { $parentid=$categfiltre->getParent()->getId(); }
}
}
$soustitre =$categfiltre->getTitre();
$description = $categfiltre->getDescription();
$protocoles = $protocoleRepository->findByCategorie($categfiltre);
$sscategories = $categorieRepository->findBy(['parent' => $catid],['titre' => 'asc']);
// if(count($sscategories) >0 ){
// foreach($sscategories as $sscatg){
// $temp = $protocoleRepository->findByCategorie($sscatg);
// if(count($temp)) $protocoles = array_merge($protocoles, $temp);
// }
// }
}
else {
//Catégorie racine Protocoles
$protocoles = $protocoleRepository->findBy([],['titre' => 'asc']);
$categfiltre = $categorieRepository->find(1);
$description = $categfiltre->getDescription();
}
//recup des photos
foreach($protocoles as $p){
$photo = $protocolephotoRepository->findOneBy(['protocole' => $p], ['ordre' => 'asc']);
if($photo != null ){
$photos[$p->getId()] = $photo->getImage()->getUrlfichier();
}
else {
$photos[$p->getId()] = null;
}
}
}
else {
$titre="Matériels";
if(is_numeric($code) && $code > 1) {
$catid = intval($code);
$categfiltre = $categorieRepository->find($catid);
if($categfiltre->getParent() != null) {
$parentid=$categfiltre->getParent()->getId();
if($parentid >2 ) {
$parentid=$categfiltre->getParent()->getParent()->getId();
if($parentid <3 ) { $parentid=$categfiltre->getParent()->getId(); }
}
}
$soustitre =$categfiltre->getTitre();
$description = $categfiltre->getDescription();
$materiels = $materielRepository->findByCategorie($categfiltre, $coche);
$sscategories = $categorieRepository->findBy(['parent' => $catid],['titre' => 'asc']);
// if(count($sscategories) >0 ){
// foreach($sscategories as $sscatg){
// $temp = $protocoleRepository->findByCategorie($sscatg);
// if(count($temp)) $materiels = array_merge($materiels, $temp);
// }
// }
}
else{
switch($coche) {
case 'S':
$materiels = $materielRepository->findBy(['codeSC' => $coche, 'archive' => false],['nom' => 'asc']);
$titre="Matériels";
$soustitre ="Matériels stérilisables";
break;
case 'C':
$materiels = $materielRepository->findBy(['codeSC' => $coche, 'archive' => false],['nom' => 'asc']);
$titre="Matériels";
$soustitre ="Matériels consommables";
break;
case 'E':
$materiels = $materielRepository->findBy(['codeSC' => $coche, 'archive' => false],['nom' => 'asc']);
$titre="Matériels";
$soustitre ="Equipements";
break;
case 'P':
$materiels = $materielRepository->findBy(['codePA' => $coche, 'archive' => false],['nom' => 'asc']);
$titre="Matériels";
$soustitre ="Matériels du plateau Praticien";
break;
case 'A':
$materiels = $materielRepository->findBy(['codePA' => $coche, 'archive' => false],['nom' => 'asc']);
$titre="Matériels";
$soustitre ="Matériels du plateau Assistante";
break;
default :
//Catégorie racine Materiels
$materiels = $materielRepository->findBy([],['nom' => 'asc']);
$categfiltre = $categorieRepository->find(2);
$description = $categfiltre->getDescription();
}
}
//recup des photos
foreach($materiels as $p){
$photo = $materielphotoRepository->findOneBy(['materiel' => $p], ['ordre' => 'asc']);
if($photo != null ){
$photos[$p->getId()] = $photo->getImage()->getUrlfichier();
}
else {
$photos[$p->getId()] = null;
}
}
}
$logPageRepository->addLog($titre." ".$soustitre, "/categoriefiltre/".$type."/".$code, $this->getUser());
return $this->render('home/pagecategories.html.twig', [
'type' => $type,
'titre' => $titre,
'materiels'=> $materiels,
'protocoles'=> $protocoles,
'soustitre' => $soustitre,
'description' => $description,
'code' => $code,
'coche' => $coche,
'categorie' => $categorieRepository->find($type),
'sscategories' => $sscategories,
'parentid' => $parentid,
'photos' => $photos,
]);
}
#[Route("/categoriefiltrenom/{type}/{nom}", name:"categoriefiltrenom_page")]
public function categoriefiltrepagenom($type, $nom, CategorieRepository $categorieRepository): Response
{
$nom = str_replace("%27","'",$nom);
$nom = str_replace("%20"," ",$nom);
$nom = trim($nom); //dd($nom);
$categfiltre = $categorieRepository->getCategoriesParNom($nom,$type); //dd($categfiltre);
$id = 1;
if($categfiltre != null ) $id=$categfiltre->getId();
if($id == 2) $id = 1; //cas matériels !!
return $this->redirectToRoute('categoriefiltre_page', ['code' => $id, 'type' => $type]);
}
#[Route("/protocole/{id}/{nom}", name:"protocole_page", defaults: ["nom"=> ""])]
public function protocolepage(Protocole $protocole, Request $request,
LogPageRepository $logPageRepository,
CommentaireRepository $commentaireRepository,
ProtocolephotoRepository $protocolephotoRepository,
EntityManagerInterface $entityManager): Response
{
if($protocole->getArchive()) {
return $this->redirectToRoute('home_page');
}
$isFavori = false;
$usermateriels = [];
//force le user courant par sécurité ;-)
$user = $this->getUserEntity();
//formulaire nouveau commentaire
$commentaire = new Commentaire();
$form = $this->createForm(CommentaireType::class, $commentaire);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid() && $user != null) {
$commentaire->setDatepubli(new \DateTime());
$commentaire->setValide(true);
$commentaire->setProtocole($protocole);
$commentaire->setAuteur($user);
$entityManager->persist($commentaire);
$entityManager->flush();
//redirection pour nouveau formulaire !
return $this->redirectToRoute('protocole_page', ['id' => $protocole->getId(), 'nom' => $protocole->getTitre()]);
}
if($user != null){
//protocole dans les favoris ?
foreach($user->getProtocoles() as $prot){
if($prot->getId() == $protocole->getId()) {
$isFavori = true;
break;
}
}
//materiels
foreach($user->getMateriels() as $matos){
$usermateriels[]=$matos->getId();
}
}
//url catégories complete
$urls=[];
$categories = $protocole->getCategories();
if($categories->count()>0) {
$categorie = $categories[0]; //dd($categorie);
$urls = $this->getCategoriesParentes($categorie);
}
$logPageRepository->addLog("Protocole ".$protocole->getTitre(), "/protocole/".$protocole->getId(), $this->getUser());
return $this->render('home/pageprotocole.html.twig', [
'urls' => $urls,
'protocole' => $protocole,
'protocolephotos' => $protocolephotoRepository->findBy(['protocole' => $protocole], ['ordre' => 'asc']),
'isFavori' => $isFavori,
'usermateriels' => $usermateriels,
'commentaires' => $commentaireRepository->findBy(['protocole'=>$protocole], ['datepubli'=>'desc']),
'form' => $form,
]);
}
#[Route("/materiel/{id}", name:"materiel_page")]
public function materielpage(Materiel $materiel, Request $request,
LogPageRepository $logPageRepository,
CommentaireRepository $commentaireRepository,
MaterielphotoRepository $materielphotoRepository,
EntityManagerInterface $entityManager): Response
{
if($materiel->isArchive()) {
return $this->redirectToRoute('home_page');
}
//force le user courant par sécurité ;-)
$user = $this->getUserEntity();
//formulaire nouveau commentaire
$commentaire = new Commentaire();
$form = $this->createForm(CommentaireType::class, $commentaire);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid() && $user != null) {
$commentaire->setDatepubli(new \DateTime());
$commentaire->setValide(true);
$commentaire->setMateriel($materiel);
$commentaire->setAuteur($user);
$entityManager->persist($commentaire);
$entityManager->flush();
//redirection pour nouveau formulaire !
return $this->redirectToRoute('materiel_page', ['id' => $materiel->getId()]);
}
//url catégories complete
$urls=[];
$categories = $materiel->getCategories();
if($categories->count()>0) {
$categorie = $categories[0]; //dd($categorie);
$urls = $this->getCategoriesParentes($categorie);
}
//photos ds produits associes
$assocphotos=[];
foreach($materiel->getAssocies() as $assoc){
$assocphotos[$assoc->getId()]=$materielphotoRepository->findBy(['materiel' => $assoc], ['ordre' => 'asc']);
}
//favori ?
$isFavori = false;
if($user != null){
//materiel dans les favoris ?
foreach($user->getMateriels() as $item){
if($item->getId() == $materiel->getId()) {
$isFavori = true;
break;
}
}
}
$logPageRepository->addLog("Matériel ".$materiel->getNom(), "/materiel/".$materiel->getId(), $this->getUser());
return $this->render('home/pagemateriel.html.twig', [
'materiel'=> $materiel,
'materielphotos' => $materielphotoRepository->findBy(['materiel' => $materiel], ['ordre' => 'asc']),
'assocphotos' => $assocphotos,
'isFavori' => $isFavori,
'urls' => $urls,
'commentaires' => $commentaireRepository->findBy(['materiel'=>$materiel], ['datepubli'=>'desc']),
'form' => $form,
]);
}
private function getCategoriesParentes($categorie) {
$urls=[];
$urls[] = $categorie->getTitre();
//parent 1
$categorie = $categorie->getParent();
if($categorie == null) return $urls;
array_unshift($urls, $categorie->getTitre());
//parent 2
$categorie = $categorie->getParent();
if($categorie == null) return $urls;
array_unshift($urls, $categorie->getTitre());
//parent 3
$categorie = $categorie->getParent();
if($categorie == null) return $urls;
array_unshift($urls, $categorie->getTitre());
//parent 4
$categorie = $categorie->getParent();
if($categorie == null) return $urls;
array_unshift($urls, $categorie->getTitre());
//parent 5
$categorie = $categorie->getParent();
if($categorie == null) return $urls;
array_unshift($urls, $categorie->getTitre());
return $urls;
}
/***********************************************************************************************
* COMPTE
*/
#[Route("/compte", name:"compte_page")]
public function comptepage(): Response
{
//force le user courant par sécurité ;-)
$user = $this->getUserEntity();
if ($user == null) {
return $this->redirectToRoute('home_page');
}
if ($user->hasRole('ROLE_ADMIN')) {
return $this->redirectToRoute('admin548637_home');
}
else {
return $this->redirectToRoute('home_page');
}
}
#[Route("/infoscompte", name:"infoscompte_page", methods:["GET","POST"])]
public function edit(Request $request, LogPageRepository $logPageRepository,
ProtocolephotoRepository $protocolephotoRepository ,
MaterielphotoRepository $materielphotoRepository,
EntityManagerInterface $entityManager): Response
{
//force le user courant par sécurité ;-)
$user = $this->getUserEntity();
if ($user == null) {
return $this->redirectToRoute('home_page');
}
$form = $this->createForm(CompteType::class, $user);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
return $this->redirectToRoute('infoscompte_page', [], Response::HTTP_SEE_OTHER);
}
//photos des favoris
$protocolesphotos =[];
$materielsphotos =[];
foreach($user->getProtocoles() as $item){
$photos = $protocolephotoRepository->findBy(['protocole' => $item], ['ordre' => 'asc']);
if(count($photos) >0)
$protocolesphotos[$item->getId()] = $photos[0];
else $protocolesphotos[$item->getId()] = null;
}
foreach($user->getMateriels() as $item){
$photos = $materielphotoRepository->findBy(['materiel' => $item], ['ordre' => 'asc']);
if(count($photos) >0)
$materielsphotos[$item->getId()] = $photos[0];
else $materielsphotos[$item->getId()] = null;
}
$logPageRepository->addLog("Mon compte", "/infoscompte/".$user->getId(), $user);
return $this->render('home/pagecompte.html.twig', [
'user' => $user,
'protocolesphotos' => $protocolesphotos,
'materielsphotos' => $materielsphotos,
'form' => $form,
]);
}
#[Route("/addusermaterielajax/{id}", name:"addusermateriel_ajax")]
public function addusermaterielajax(Materiel $materiel, EntityManagerInterface $entityManager): Response
{
//force le user courant par sécurité ;-)
$user = $this->getUserEntity();
if ($user == null) {
return new Response(false);
}
//test si existe déjà
foreach($user->getMateriels() as $usermat){
if($usermat->getId() == $materiel->getId()) {
return new Response(true); //existe déjà
}
}
//sinon l'ajoute
$user->addMateriel($materiel);
$entityManager->flush();
return new Response(true);
}
#[Route("/adduserprotocole/{id}", name:"adduserprotocole_ajax")]
public function adduserprotocole(Protocole $protocole, EntityManagerInterface $entityManager): Response
{
//force le user courant par sécurité ;-)
$user = $this->getUserEntity();
if ($user != null) {
//test si existe déjà
foreach($user->getProtocoles() as $userprot){
if($userprot->getId() == $protocole->getId()) {
return $this->redirectToRoute('protocole_page', ['id' => $protocole->getId(), 'nom' => $protocole->getTitre()]); //existe déjà
}
}
//sinon l'ajoute
$user->addProtocole($protocole);
$entityManager->flush();
}
return $this->redirectToRoute('protocole_page', ['id' => $protocole->getId(), 'nom' => $protocole->getTitre()]);
}
#[Route("/addusermateriel/{id}", name:"addusermateriel")]
public function addusermateriel(Materiel $materiel, EntityManagerInterface $entityManager): Response
{
//force le user courant par sécurité ;-)
$user = $this->getUserEntity();
if ($user != null) {
//test si existe déjà
foreach($user->getMateriels() as $usermat){
if($usermat->getId() == $materiel->getId()) {
return new Response(true); //existe déjà
}
}
//sinon l'ajoute
$user->addMateriel($materiel);
$entityManager->flush();
}
return $this->redirectToRoute('materiel_page', ['id' => $materiel->getId()]);
}
#[Route("/removeuserprotocole/{id}", name:"removeuserprotocole_ajax")]
public function removeuserprotocole(Protocole $protocole, EntityManagerInterface $entityManager): Response
{
//force le user courant par sécurité ;-)
$user = $this->getUserEntity();
if ($user != null) {
$user->removeProtocole($protocole);
$entityManager->flush();
}
return $this->redirectToRoute('protocole_page', ['id' => $protocole->getId(), 'nom' => $protocole->getTitre()]);
}
#[Route("/removeusermateriel/{id}", name:"removeusermateriel_ajax")]
public function removeusermateriel(Materiel $materiel, EntityManagerInterface $entityManager): Response
{
//force le user courant par sécurité ;-)
$user = $this->getUserEntity();
if ($user != null) {
$user->removeMateriel($materiel);
$entityManager->flush();
}
return $this->redirectToRoute('materiel_page', ['id' => $materiel->getId()]);
}
#[Route("/removecompteprotocole/{id}", name:"removecompteprotocole_page")]
public function removecompteprotocole(Protocole $protocole, EntityManagerInterface $entityManager): Response
{
//force le user courant par sécurité ;-)
$user = $this->getUserEntity();
if ($user != null) {
$user->removeProtocole($protocole);
$entityManager->flush();
}
return $this->redirectToRoute('infoscompte_page');
}
#[Route("/removecomptemateriel/{id}", name:"removecomptemateriel_page")]
public function removecomptemateriel(Materiel $materiel, EntityManagerInterface $entityManager): Response
{
//force le user courant par sécurité ;-)
$user = $this->getUserEntity();
if ($user != null) {
$user->removeMateriel($materiel);
$entityManager->flush();
}
return $this->redirectToRoute('infoscompte_page');
}
/***********************************************************************************************
* RECHERCHER
*/
#[Route("/recherche", name:"recherche_page")]
public function recherchepage(Request $request,
ProtocoleRepository $protocoleRepository,
MaterielRepository $materielRepository,
ArticleRepository $articleRepository,
CategorieRepository $categorieRepository): Response
{
$texte = $request->query->get('txtrecherche', '');
$texte = trim($texte);
if(strlen($texte)>2 && $texte[strlen($texte)-1] == "s") $texte = substr($texte, 0, strlen($texte)-1);
$enctexte = htmlentities($texte); //dd( $texte);
$categories = $categorieRepository->recherche($texte); //dd( $categories);
$protocoles1 = $protocoleRepository->rechercheTitre($texte, $enctexte); //dd( $protocoles);
$protocoles2 = $protocoleRepository->rechercheAutres($texte, $enctexte); //dd( $protocoles);
$materiels1 = $materielRepository->rechercheTitre($texte, $enctexte); //dd( $materiels);
$materiels2 = $materielRepository->rechercheAutres($texte, $enctexte); //dd( $materiels);
$articles = $articleRepository->recherche($texte, $enctexte); //dd( $articles);
return $this->render('home/recherches.html.twig', [
'texte'=> $texte,
'protocoles1'=> $protocoles1,
'protocoles2'=> $protocoles2,
'materiels1'=> $materiels1,
'materiels2'=> $materiels2,
'articles'=> $articles,
'categories'=> $categories,
]);
}
/***********************************************************************************************
* MENU PAGE
*/
#[Route("/menu", name:"menu_page")]
public function menuPage(CategorieRepository $categorieRepository) {
return $this->render('menu/menuPage.html.twig',
[
'protocoles' => $categorieRepository->findOneBy(['titre' => 'Protocoles']),
'materiels' => $categorieRepository->findOneBy(['titre' => 'Matériels']),
]);
}
}