From eca7824fda46227d7ea0fb4fef54f9dd9951aa33 Mon Sep 17 00:00:00 2001 From: Vincent Amstoutz Date: Mon, 8 Sep 2025 11:06:44 +0200 Subject: [PATCH] fix(operations): remove legacy doc about controllers Will fix https://github.com/api-platform/docs/issues/2134 --- core/operations.md | 164 --------------------------------------------- 1 file changed, 164 deletions(-) diff --git a/core/operations.md b/core/operations.md index 8e637c2d473..fbc0fecbaa8 100644 --- a/core/operations.md +++ b/core/operations.md @@ -479,167 +479,3 @@ resources: API Platform will find the operation matching this `itemUriTemplate` and use it to generate the IRI. If this option is not set, the first `Get` operation is used to generate the IRI. - -## Expose a Model Without Any Routes - -Sometimes, you may want to expose a model, but want it to be used through subrequests only, and never through item or collection operations. -Because the OpenAPI standard requires at least one route to be exposed to make your models consumable, let's see how you can manage this kind -of issue. - -Let's say you have the following entities in your project: - -```php -decorated = $decorated; - } - - public function __invoke(array $context = []): OpenApi - { - $openApi = $this->decorated->__invoke($context); - - $paths = $openApi->getPaths()->getPaths(); - - $filteredPaths = new Model\Paths(); - foreach ($paths as $path => $pathItem) { - // If a prefix is configured on API Platform's routes, it must appear here. - if ($path === '/weathers/{id}') { - continue; - } - $filteredPaths->addPath($path, $pathItem); - } - - return $openApi->withPaths($filteredPaths); - } -} -``` - -That's it: your route is gone!