src/Controller/ServiceController.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Service\StaticData;
  4. use App\Repository\PageHeaderRepository;
  5. use App\Repository\ServiceCategoryRepository;
  6. use Doctrine\ORM\EntityManagerInterface;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  10. class ServiceController extends AbstractController
  11. {
  12.     public function __construct(EntityManagerInterface $managerStaticData $statics)
  13.     {
  14.         $this->manager $manager;
  15.         $this->statics $statics->getStaticData();
  16.     }
  17.     
  18.     /**
  19.      * @Route("/{_locale}/services", name="service_index")
  20.      */
  21.     public function index(PageHeaderRepository $pageRepoServiceCategoryRepository $categoryRepo): Response
  22.     {
  23.         $page $pageRepo->findOneBy(['page' => 'service']);
  24.         $categories $categoryRepo->findAll();
  25.         return $this->render('service/index.html.twig', [
  26.             'statics' => $this->statics['data'],
  27.             'page' => $page,
  28.             'categories' => $categories,
  29.         ]);
  30.     }
  31. }