src/Controller/ActuController.php line 42

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Symfony\Component\HttpFoundation\Request;
  7. use App\Entity\DocumentsCGVReglement;
  8. use App\Repository\DocumentsCGVReglementRepository;
  9. use App\Entity\Articles;
  10. use App\Repository\ArticlesRepository;
  11. use App\Entity\Certifications;
  12. use App\Repository\CertificationsRepository;
  13. class ActuController extends AbstractController
  14. {
  15.     /**
  16.      * @Route("/actualites", name="actualites")
  17.      */
  18.     public function actualites(
  19.         ArticlesRepository $articlesRepository,
  20.      DocumentsCGVReglementRepository $documentsCGVReglementRepository
  21.      CertificationsRepository $certificationsRepository): Response
  22.     {
  23.         $certifications $certificationsRepository->findAll();
  24.         $documentCGVReglement $documentsCGVReglementRepository->findAll();
  25.         $articles $articlesRepository->findBy([],["id" => "DESC"]);
  26.         return $this->render('actu/index.html.twig', [
  27.             'articles' => $articles,
  28.             "documentCGVReglement" => $documentCGVReglement
  29.             "certifications" => $certifications
  30.         ]);
  31.     }
  32.     /**
  33.      * @Route("/article/{id}", name="article")
  34.      */
  35.     public function article(Request $requestArticlesRepository $articlesRepositoryDocumentsCGVReglementRepository $documentsCGVReglementRepositoryCertificationsRepository $certificationsRepository): Response
  36.     {
  37.         $documentCGVReglement $documentsCGVReglementRepository->findAll();
  38.         $certifications $certificationsRepository->findAll();
  39.         $article $articlesRepository->findOneBy(["id" => $request->get("id")]);
  40.         return $this->render('actu/article.html.twig', [
  41.             'article' => $article,
  42.             "documentCGVReglement" => $documentCGVReglement
  43.             "certifications" => $certifications
  44.         ]);
  45.     }
  46. }