src/Controller/ArticleController.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\Routing\Annotation\Route;
  5. use App\Entity\Site\Article;
  6. use App\Repository\Site\ArticleRepository;
  7. use App\Repository\Site\ArticleTagProduitRepository;
  8. use App\Repository\Site\ArticleTagRepository;
  9. use Doctrine\ORM\EntityManagerInterface;
  10. class ArticleController extends AbstractController
  11. {
  12.     /**
  13.      * @Route("/magazine/{seoUrl}", name="article")
  14.      */
  15.     public function index(Article $article)
  16.     {
  17.         $urlImageEnTete $this->getParameter('app.path.article_images').'/';
  18.         $urlImageRow $this->getParameter('app.path.template_row').'/';
  19.         return $this->render('article/article.html.twig', [
  20.             "urlImageEnTete" => $urlImageEnTete,
  21.             'article' => $article,
  22.             'urlImageRow' => $urlImageRow,
  23.         ]);
  24.     }
  25.     /**
  26.      * @Route("/magazine", name="article_list")
  27.      */
  28.     public function list(ArticleRepository $articleRepositoryArticleTagRepository $articleTagRepositoryArticleTagProduitRepository $articleTagProduitRepository)
  29.     {
  30.         $urlImageArticle $this->getParameter('app.path.article_images').'/';
  31.         $tagProduits $articleTagProduitRepository->findBy([], ['placement' => 'ASC']);
  32.         $articles $articleRepository->findActif();
  33.         $tags $articleTagRepository->findBy([], ['placement' => 'ASC']);
  34.     
  35.         return $this->render('article/list.html.twig', [
  36.             "urlImageArticle" => $urlImageArticle,
  37.             'articles' => $articles,
  38.             "tags" => $tags,
  39.             "tagProduits" => $tagProduits,
  40.         ]);
  41.     }
  42. }