<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Doctrine\Persistence\ManagerRegistry;
use App\Entity\Images;
use App\Entity\Annonces;
use App\Controller\Fonctions\Fonctions;
class GalleryController extends AbstractController
{
#[Route('/gallery/{slug}', name: 'app_gallery')]
public function index( ManagerRegistry $doctrine,$slug): Response
{
$fonction = new Fonctions();
$logo = $fonction->FonctionLogo();
$entityManager = $doctrine->getManager();
$userRepo = $entityManager->getRepository(Annonces::class);
$id = $userRepo->findOneBy(["slug" => $slug]);
$image = $id->getImage();
$titre = $id->getTitre();
// création de la gallerie image
$userRepo = $entityManager->getRepository(Images::class);
$images = $userRepo->findBy(["annonce" => $id]);
return $this->render('gallery/index.html.twig', [
'images' => $images,
'image' => $image,
'titre' => $titre,
'logo' => $logo,
]);
}
}