Skip to content

Commit 7100e39

Browse files
authored
Merge pull request #448 from jonag/patch-3
Fix documentation for custom operation configuration
2 parents 5e81a9c + 689c5ab commit 7100e39

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/operations.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ use App\Controller\BookSpecial;
556556
* @ApiResource(itemOperations={
557557
* "get",
558558
* "special"={
559+
* "method"="GET",
559560
* "path"="/books/{id}/special",
560561
* "controller"=BookSpecial::class
561562
* }
@@ -575,6 +576,7 @@ App\Entity\Book:
575576
itemOperations:
576577
get: ~
577578
special:
579+
method: 'GET'
578580
path: '/books/{id}/special'
579581
controller: 'App\Controller\BookSpecial'
580582
```
@@ -593,6 +595,7 @@ Or in XML:
593595
<itemOperations>
594596
<itemOperation name="get" />
595597
<itemOperation name="special">
598+
<attribute name="method">GET</attribute>
596599
<attribute name="path">/books/{id}/special</attribute>
597600
<attribute name="controller">App\Controller\BookSpecial</attribute>
598601
</itemOperation>
@@ -601,7 +604,7 @@ Or in XML:
601604
</resources>
602605
```
603606

604-
It is mandatory to set the `path` and `controller` attributes. They allow API platform to configure the routing path and
607+
It is mandatory to set the `method`, `path` and `controller` attributes. They allow API platform to configure the routing path and
605608
the associated controller respectively.
606609

607610
If you want to bypass the automatic retrieval of the entity in your custom operation, you can set the parameter

0 commit comments

Comments
 (0)