xmlLoader->loadAll(); return $this->json($hotels, Response::HTTP_OK, [], ['groups' => 'api:list']); } #[Route('/hotels/{id}', name: 'api_hotels_single')] public function single(int $id): JsonResponse { try { $hotel = $this->xmlLoader->loadById($id); return $this->json($hotel, Response::HTTP_OK, [], ['groups' => 'api:single']); } catch (HotelNotFoundException $e) { return new JsonResponse(['message' => 'Not found'], Response::HTTP_NOT_FOUND); } } }