src/Controller/ArticleController.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Repository\ArticlesRepository;
  4. use App\Repository\CommentsRepository;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  8. class ArticleController extends AbstractController
  9. {
  10.     #[Route('/article/{id}'name'app_article'methods: ['GET''POST'])]
  11.     public function oneArticle($idArticlesRepository $ArticlesRepositoryCommentsRepository $CommentsRepository): Response
  12.     {        
  13.         $one_article $ArticlesRepository->findBy(array('id' => $id));
  14.         $comments $CommentsRepository->findBy(array('article' => $one_article));
  15.         return $this->renderForm('articles/index.html.twig', [
  16.             'controller_name' => 'OneArticleController',
  17.             'one_article' => $one_article,
  18.             'comments' => $comments,
  19.         ]);
  20.     }
  21.     
  22.    
  23. }