From 3570d0c4836273a11a63896428d89262f3e55672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Sat, 3 Dec 2022 12:33:12 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Update=20MapperController.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Controller/App/MapperController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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;