src/Controller/HomeController.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Repository\GerichtRepository;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. class HomeController extends AbstractController
  8. {
  9.     #[Route('/'name'app_home')]
  10.     public function index(GerichtRepository $gr): Response
  11.     {
  12.         
  13.         $gerichte $gr->findAll();
  14.         $zufall array_rand($gerichte2);
  15.         //dump($gerichte[$zufall[0]]);
  16.         //dump($gerichte[$zufall[1]]);
  17.         
  18.         return $this->render('home/index.html.twig', [
  19.             'gericht1' => $gerichte[$zufall[0]],
  20.             'gericht2' => $gerichte[$zufall[1]]
  21.         ]);
  22.     }
  23. }