$uriVariables * @param array $context * * @throws \Doctrine\ORM\Exception\ORMException * @throws \Doctrine\ORM\OptimisticLockException */ public function provide(Operation $operation, array $uriVariables = [], array $context = []): TraversablePaginator|FreemiumPlace|null { if ($operation instanceof GetCollection) { throw new \RuntimeException('not supported', Response::HTTP_METHOD_NOT_ALLOWED); } return $this->provideItem($uriVariables, $context); } /** * @param array $uriVariables * @param array $context * * @throws \Doctrine\ORM\Exception\ORMException * @throws \Doctrine\ORM\OptimisticLockException */ private function provideItem(array $uriVariables, array $context): ?FreemiumPlace { /** @var Place $place */ $place = $this->placeRepository->find($uriVariables['id']); if(empty($place)){ throw new NotFoundHttpException('place not found'); } return $this->objectMapper->map($place, FreemiumPlace::class); } }