<?php
namespace App\Controller;
use App\Repository\PropertyManagementServiceRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class ServiceOverviewController extends AbstractController
{
#[Route('/leistungsuebersicht', name: 'app_service_overview')]
public function index(PropertyManagementServiceRepository $serviceRepository): Response
{
$allServices = $serviceRepository->findAllOrdered('general');
$groupedServices = [];
foreach ($allServices as $service) {
$cat = $service->getCategory();
$sub = $service->getSubCategory() ?: '_none';
$groupedServices[$cat][$sub][] = $service;
}
return $this->render('service_overview/index.html.twig', [
'groupedServices' => $groupedServices,
]);
}
}