Skip to content

Commit b57c426

Browse files
author
Philippe CARLE
committed
Add defaults to operations configuration
1 parent 2c29225 commit b57c426

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/operations.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ use ApiPlatform\Core\Annotation\ApiResource;
128128

129129
/**
130130
* @ApiResource(itemOperations={
131-
* "get"={"method"="GET", "path"="/grimoire/{id}", "requirements"={"id"="\d+"}},
131+
* "get"={"method"="GET", "path"="/grimoire/{id}", "requirements"={"id"="\d+"}, "defaults"={"color"="brown"}},
132132
* "put"={"method"="PUT", "path"="/grimoire/{id}/update", "hydra_context"={"foo"="bar"}},
133133
* })
134134
*/
@@ -148,6 +148,8 @@ AppBundle\Entity\Book:
148148
path: '/grimoire/{id}'
149149
requirements:
150150
id: '\d+'
151+
defaults:
152+
color: 'brown'
151153
put:
152154
method: 'PUT'
153155
path: '/grimoire/{id}/update'
@@ -172,6 +174,9 @@ AppBundle\Entity\Book:
172174
<attribute name="requirements">
173175
<attribute name="id">\d+</attribute>
174176
</attribute>
177+
<attribute name="default">
178+
<attribute name="color">brown</attribute>
179+
</attribute>
175180
</itemOperation>
176181
<itemOperation name="put">
177182
<attribute name="method">PUT</attribute>

0 commit comments

Comments
 (0)