public function resourceAction($repositoryName, $path) { $repository = $this->registry->get($repositoryName); $resource = $repository->get('/' . $path); $context = SerializationContext::create(); $context->enableMaxDepthChecks(); $context->setSerializeNull(true); $json = $this->serializer->serialize($resource, 'json', $context); $response = new Response($json); $response->headers->set('Content-Type', 'application/json'); return $response; }
/** * Deletes the resource. * * @param string $repositoryName * @param string $path * * @return Response */ public function deleteResourceAction($repositoryName, $path) { $repository = $this->registry->get($repositoryName); $this->failOnNotEditable($repository, $repositoryName); $path = '/' . ltrim($path, '/'); $repository->remove($path); return $this->createResponse('', Response::HTTP_NO_CONTENT); }