'json'])] public function getGeographicalUnitCoveringAddress(Address $address): JsonResponse { if (!$this->security->isGranted('ROLE_USER')) { throw new AccessDeniedHttpException(); } $count = $this->geographicalUnitRepository->countGeographicalUnitContainingAddress($address); $pagination = $this->paginatorFactory->create($count); $units = $this->geographicalUnitRepository->findGeographicalUnitContainingAddress($address, $pagination->getCurrentPageFirstItemNumber(), $pagination->getItemsPerPage()); $collection = new Collection($units, $pagination); return new JsonResponse( $this->serializer->serialize($collection, 'json', [AbstractNormalizer::GROUPS => ['read']]), JsonResponse::HTTP_OK, [], true ); } }