diff --git a/src/Controller/App/MapperController.php b/src/Controller/App/MapperController.php index 78abe8103..4aae345af 100644 --- a/src/Controller/App/MapperController.php +++ b/src/Controller/App/MapperController.php @@ -35,11 +35,11 @@ public function __construct( #[Route('/{regionKey}/mapper/{id}', name: 'app_mapper', requirements: ['regionKey' => '[\w\-_]+'])] #[Route('/{continent}/{regionKey}/mapper/{id}', name: 'app_mapper_full', requirements: ['continent' => 'asia|africa|australia|europe|north-america|south-america', 'regionKey' => '[\w\-_]+'])] #[IsGranted('ROLE_USER')] - public function index(Request $request, Mapper $mapper, string $regionKey, ?string $continent): Response + public function index(Request $request, string $regionKey, int $id, ?string $continent): Response { $region = $this->provider->getRegion($continent, $regionKey); - $this->mapper = $mapper; + $this->mapper = $this->entityManager->find(Mapper::class, $id); $mapperRegions = array_map(fn (Region $region) => $region->getId(), $this->mapper->getRegion()->toArray()); @@ -76,7 +76,7 @@ public function index(Request $request, Mapper $mapper, string $regionKey, ?stri $firstChangetsetCreatedAt = array_map(fn (Mapper $mapper): ?\DateTimeImmutable => $mapper->getFirstChangeset()->getCreatedAt(), $mappers); array_multisort($firstChangetsetCreatedAt, \SORT_DESC, $mappers); - $current = array_search($mapper, $mappers, true); + $current = array_search($this->mapper, $mappers, true); $prev = $current > 0 ? $mappers[$current - 1] : null; $next = $current < (\count($mappers) - 1) ? $mappers[$current + 1] : null;