Skip to content

Commit 7100414

Browse files
authored
Merge pull request #1 from borNfreee/patch-3
Replace collectionOperations with subresourceOperations
2 parents 8aa9a54 + a7d8ade commit 7100414

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

core/operations.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ If you put the subresource on a relation that is to-many, you will retrieve a co
376376

377377
Last but not least, subresources can be nested, such that `/questions/42/answer/comments` will get the collection of comments for the answer to question 42.
378378

379-
You may want custom groups on subresources. Because a subresource is nothing more than a collection operation, you can set `normalization_context` or `denormalization_context` on that operation. To do so, you need to override `collectionOperations`. Based on the above operation, because we retrieve an answer, we need to alter its configuration:
379+
You may want custom groups on subresources. Because a subresource is nothing more than a collection operation, you can set `normalization_context` or `denormalization_context` on that operation. To do so, you need to override `subresourceOperations`. Based on the above operation, because we retrieve an answer, we need to alter its configuration:
380380

381381
```php
382382
<?php
@@ -421,16 +421,16 @@ Or in XML:
421421
xsi:schemaLocation="https://api-platform.com/schema/metadata
422422
https://api-platform.com/schema/metadata/metadata-2.0.xsd">
423423
<resource class="App\Entity\Answer">
424-
<collectionOperations>
425-
<collectionOperation name="api_questions_answer_get_subresource">
424+
<subresourceOperations>
425+
<subresourceOperation name="api_questions_answer_get_subresource">
426426
<attribute name="method">GET</attribute>
427427
<attribute name="normalization_context">
428428
<attribute name="groups">
429429
<attribute>foobar</attribute>
430430
</attribute>
431431
</attribute>
432-
</collectionOperation>
433-
</collectionOperations>
432+
</subresourceOperation>
433+
</subresourceOperations>
434434
</resource>
435435
</resources>
436436
```

0 commit comments

Comments
 (0)