Skip to content

Commit 7e28783

Browse files
authored
Fix disabling operations doc (#1269)
* Undocument the disabling of item operations * fix lint
1 parent ef08308 commit 7e28783

File tree

3 files changed

+2
-54
lines changed

3 files changed

+2
-54
lines changed

core/data-persisters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ services:
150150

151151
## Calling multiple DataPersisters
152152

153-
Our DataPersisters are called in chain, once a data persister is supported the chain breaks and API Platform assumes your data is persisted. You can call mutliple data persisters by implementing the `ResumableDataPersisterInterface`:
153+
Our DataPersisters are called in chain, once a data persister is supported the chain breaks and API Platform assumes your data is persisted. You can call mutliple data persisters by implementing the `ResumableDataPersisterInterface`:
154154

155155
```php
156156
namespace App\DataPersister;

core/messenger.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Because the `messenger` attribute is `true`, when a `POST` is handled by API Pla
7373
For this example, only the `POST` operation is enabled. We disabled the item operation using the `NotFoundAction`. A resource must have at least one item operation as it must be identified by an IRI, here the route `/people/1` exists, eventhough it returns a 404 status code.
7474
We use the `status` attribute to configure API Platform to return a [202 Accepted HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202).
7575
It indicates that the request has been received and will be treated later, without giving an immediate return to the client.
76-
Finally, the `output` attribute is set to `false`, so the HTTP response that will be generated by API Platform will be empty, and the [serialization process](serialization.md) will be skipped.
76+
Finally, the `output` attribute is set to `false`, so the HTTP response that will be generated by API Platform will be empty, and the [serialization process](serialization.md) will be skipped.
7777

7878
**Note:** when using `messenger=true` ApiResource attribute in a Doctrine entity, the Doctrine DataPersister is not called. If you want the Doctrine DataPersister to be called, you should implement a `ResumableDataPersisterInterface` [documented here](data-persisters.md).
7979

core/operations.md

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -171,58 +171,6 @@ App\Entity\Book:
171171

172172
[/codeSelector]
173173

174-
You can also disable all operations for an item or a collection. This example disables every item-related routes (PUT, GET, DELETE):
175-
176-
[codeSelector]
177-
178-
```php
179-
<?php
180-
// api/src/Entity/Book.php
181-
182-
namespace App\Entity;
183-
184-
use ApiPlatform\Core\Annotation\ApiResource;
185-
186-
/**
187-
* ...
188-
* @ApiResource(
189-
* collectionOperations={"get"},
190-
* itemOperations={}
191-
* )
192-
*/
193-
class Book
194-
{
195-
// ...
196-
}
197-
```
198-
199-
```yaml
200-
# api/config/api_platform/resources.yaml
201-
App\Entity\Book:
202-
collectionOperations:
203-
get: ~ # nothing more to add if we want to keep the default controller
204-
itemOperations: []
205-
```
206-
207-
```xml
208-
<?xml version="1.0" encoding="UTF-8" ?>
209-
<!-- api/config/api_platform/resources.xml -->
210-
211-
<resources xmlns="https://api-platform.com/schema/metadata"
212-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
213-
xsi:schemaLocation="https://api-platform.com/schema/metadata
214-
https://api-platform.com/schema/metadata/metadata-2.0.xsd">
215-
<resource class="App\Entity\Book">
216-
<collectionOperations>
217-
<collectionOperation name="get" />
218-
</collectionOperations>
219-
<itemOperations />
220-
</resource>
221-
</resources>
222-
```
223-
224-
[/codeSelector]
225-
226174
API Platform Core is smart enough to automatically register the applicable Symfony route referencing a built-in CRUD action
227175
just by specifying the method name as key, or by checking the explicitly configured HTTP method.
228176

0 commit comments

Comments
 (0)