Skip to content

Commit fd5bc35

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

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

core/operations.md

Lines changed: 17 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"}, "options"={"my_option"="my_option_value", "schemes"={"https"}, "host"="{subdomain}.api-platform.com"}},
132132
* "put"={"method"="PUT", "path"="/grimoire/{id}/update", "hydra_context"={"foo"="bar"}},
133133
* })
134134
*/
@@ -148,6 +148,12 @@ AppBundle\Entity\Book:
148148
path: '/grimoire/{id}'
149149
requirements:
150150
id: '\d+'
151+
defaults:
152+
color: 'brown'
153+
host: '{subdomain}.api-platform.com'
154+
schemes: ['https']
155+
options:
156+
my_option: 'my_option_value'
151157
put:
152158
method: 'PUT'
153159
path: '/grimoire/{id}/update'
@@ -172,6 +178,16 @@ AppBundle\Entity\Book:
172178
<attribute name="requirements">
173179
<attribute name="id">\d+</attribute>
174180
</attribute>
181+
<attribute name="defaults">
182+
<attribute name="color">brown</attribute>
183+
</attribute>
184+
<attribute name="options">
185+
<attribute name="color">brown</attribute>
186+
</attribute>
187+
<attribute name="schemes">
188+
<attribute>https</attribute>
189+
</attribute>
190+
<attribute name="host">{subdomain}.api-platform.com</attribute>
175191
</itemOperation>
176192
<itemOperation name="put">
177193
<attribute name="method">PUT</attribute>

0 commit comments

Comments
 (0)