src/Controller/ServiceOverviewController.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Repository\PropertyManagementServiceRepository;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. class ServiceOverviewController extends AbstractController
  8. {
  9. #[Route('/leistungsuebersicht', name: 'app_service_overview')]
  10. public function index(PropertyManagementServiceRepository $serviceRepository): Response
  11. {
  12. $allServices = $serviceRepository->findAllOrdered('general');
  13. $groupedServices = [];
  14. foreach ($allServices as $service) {
  15. $cat = $service->getCategory();
  16. $sub = $service->getSubCategory() ?: '_none';
  17. $groupedServices[$cat][$sub][] = $service;
  18. }
  19. return $this->render('service_overview/index.html.twig', [
  20. 'groupedServices' => $groupedServices,
  21. ]);
  22. }
  23. }