src/Controller/GalleryController.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Product;
  4. use App\Entity\Gallery;
  5. use Doctrine\ORM\EntityManagerInterface;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  9. class GalleryController extends AbstractController
  10. {
  11.     private $entityManager;
  12.     public function __construct(EntityManagerInterface $entityManager){
  13.        $this->entityManager $entityManager;
  14.     }
  15.     #[Route('/galerie'name'app_gallery')]
  16.     public function index(): Response
  17.     {
  18.         $images $this->entityManager->getRepository(Gallery::class)->findAll();
  19.         $activity $this->entityManager->getRepository(Product::class)->findAll();
  20.         return $this->render('gallery/index.html.twig', [
  21.             'images' => $images,
  22.             'activity' => $activity
  23.         ]);
  24.     }
  25. }