<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use App\Entity\ReaDigital;
use App\Entity\CatDigital;
class ReaDigitalController extends AbstractController
{
/**
* @Route("/rea_digital", name="digital")
*/
public function index(ManagerRegistry $doctrine): Response
{
// try {
// $bdd = new \PDO('mysql:host=localhost;dbname=c1stage2;charset=utf8', 'c1stage', 'xZmAh!o89D');
// } catch (Exception $e) {
// die('Erreur : ' . $e->getMessage());
// }
$em = $doctrine->getManager();
$realisations = $em->getRepository(ReaDigital::class)->findAll();
$categories = $em->getRepository(CatDigital::class)->findAll();
// var_dump($realisations);
// die();
return $this->render('rea_digital/index.html.twig', [
'realisations' => $realisations,
'categories' => $categories,
'controller_name' => 'ReaDigitalController',
]);
}
}