<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
use App\Entity\DocumentsCGVReglement;
use App\Repository\DocumentsCGVReglementRepository;
use App\Entity\Articles;
use App\Repository\ArticlesRepository;
use App\Entity\Certifications;
use App\Repository\CertificationsRepository;
class ActuController extends AbstractController
{
/**
* @Route("/actualites", name="actualites")
*/
public function actualites(
ArticlesRepository $articlesRepository,
DocumentsCGVReglementRepository $documentsCGVReglementRepository,
CertificationsRepository $certificationsRepository): Response
{
$certifications = $certificationsRepository->findAll();
$documentCGVReglement = $documentsCGVReglementRepository->findAll();
$articles = $articlesRepository->findBy([],["id" => "DESC"]);
return $this->render('actu/index.html.twig', [
'articles' => $articles,
"documentCGVReglement" => $documentCGVReglement,
"certifications" => $certifications
]);
}
/**
* @Route("/article/{id}", name="article")
*/
public function article(Request $request, ArticlesRepository $articlesRepository, DocumentsCGVReglementRepository $documentsCGVReglementRepository, CertificationsRepository $certificationsRepository): Response
{
$documentCGVReglement = $documentsCGVReglementRepository->findAll();
$certifications = $certificationsRepository->findAll();
$article = $articlesRepository->findOneBy(["id" => $request->get("id")]);
return $this->render('actu/article.html.twig', [
'article' => $article,
"documentCGVReglement" => $documentCGVReglement,
"certifications" => $certifications
]);
}
}