src/Infra/Symfony/Controller/HomeController.php line 16

  1. <?php
  2. declare(strict_types=1);
  3. namespace Infra\Symfony\Controller;
  4. use Infra\Symfony\Persistance\Doctrine\Repository\PlaylistRepository;
  5. use Infra\Symfony\Persistance\Doctrine\Repository\VideoRepository;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. class HomeController extends AbstractController
  10. {
  11.     #[Route('/'name:'app_index')]
  12.     public function indexAction(VideoRepository $videoRepository): Response
  13.     {
  14.         $videos $videoRepository->findLastVideos(8);
  15.         return $this->render('home/index.html.twig', [
  16.             'videos' => $videos,
  17.             'breadcrumb' => $this->getBreadcurmb()
  18.         ]);
  19.     }
  20.     private function getBreadcurmb(): array
  21.     {
  22.         $breadcrumb = [];
  23.         $breadcrumb['items'][] = ['title' => 'Home''url' => '/'];
  24.         return $breadcrumb;
  25.     }
  26. }