src/Controller/MovieController.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Product;
  4. use App\Entity\Movie;
  5. use Doctrine\ORM\EntityManagerInterface;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  9. class MovieController extends AbstractController
  10. {
  11.     private $entityManager;
  12.     public function __construct(EntityManagerInterface $entityManager){
  13.        $this->entityManager $entityManager;
  14.     }
  15.     #[Route('/instant-nature'name'app_movie')]
  16.     public function index(): Response
  17.     {
  18.         $activity $this->entityManager->getRepository(Product::class)->findAll();
  19.         $movies $this->entityManager->getRepository(Movie::class)->findAll();
  20.         return $this->render('movie/index.html.twig', [
  21.             'controller_name' => 'MovieController',
  22.             'movies' => $movies,
  23.             'activity' => $activity,
  24.         ]);
  25.     }
  26. }