src/Controller/ArticleController.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Articles;
  4. use App\Repository\CommentsRepository;
  5. use App\Repository\UserRepository;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. class ArticleController extends AbstractController
  10. {
  11.     #[Route('/article/{id}'name'article_show')]
  12.     public function show(?Articles $article): Response
  13.     {
  14.         if (!$article)
  15.         {
  16.             return $this->redirectToRoute(route'app_home');
  17.         }
  18.         return $this->render('article/show.html.twig', [
  19.             "article" => $article,
  20.         ]);
  21.     }
  22. }