src/Controller/HobbyController.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Service\StaticData;
  4. use App\Repository\HobbyAreaRepository;
  5. use App\Repository\HobbySingleRepository;
  6. use App\Repository\PageHeaderRepository;
  7. use Doctrine\ORM\EntityManagerInterface;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  11. class HobbyController extends AbstractController
  12. {
  13.     public function __construct(EntityManagerInterface $managerStaticData $statics)
  14.     {
  15.         $this->manager $manager;
  16.         $this->statics $statics->getStaticData();
  17.     }
  18.     
  19.     /**
  20.      * @Route("/{_locale}/activites", name="hobby_index")
  21.      */
  22.     public function index(PageHeaderRepository $pageRepoHobbyAreaRepository $areaRepoHobbySingleRepository $hobbiesRepo): Response
  23.     {
  24.         $page $pageRepo->findOneBy(['page' => 'hobby']);
  25.         $area $areaRepo->findOneBy([]);
  26.         $hobbies $hobbiesRepo->findBy(['display' => true], ['position' => 'ASC']); 
  27.         return $this->render('hobby/index.html.twig', [
  28.             'statics' => $this->statics['data'],
  29.             'page' => $page,
  30.             'area' => $area,
  31.             'hobbies' => $hobbies
  32.         ]);
  33.     }
  34. }