File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,13 @@ class Question
81
81
}
82
82
```
83
83
84
+ ``` yaml
85
+ # api/config/api_platform/resources.yaml
86
+ resources :
87
+ App\Entity\Answer : ~
88
+ App\Entity\Question : ~
89
+ ` ` `
90
+
84
91
` ` ` xml
85
92
<?xml version="1.0" encoding="UTF-8" ?>
86
93
<!-- api/config/api_platform/resources.xml -->
@@ -129,6 +136,21 @@ class Answer
129
136
}
130
137
```
131
138
139
+ ``` yaml
140
+ # api/config/api_platform/resources.yaml
141
+ resources :
142
+ App\Entity\Answer :
143
+ uriTemplate : /questions/{id}/answer
144
+ uriVariable :
145
+ id :
146
+ fromClass : App\Entity\Question
147
+ fromProperty : answer
148
+ operations :
149
+ ApiPlatform\Metadata\Get : ~
150
+
151
+ App\Entity\Question : ~
152
+ ` ` `
153
+
132
154
` ` ` xml
133
155
<resources xmlns="https://api-platform.com/schema/metadata/resources-3.0"
134
156
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -173,6 +195,19 @@ If we had a `relatedQuestions` property on the `Answer` we could retrieve the co
173
195
)]
174
196
```
175
197
198
+ ``` yaml
199
+ # api/config/api_platform/resources.yaml
200
+ resources :
201
+ App\Entity\Question :
202
+ uriTemplate : /answers/{id}/related_questions.{_format}
203
+ uriVariable :
204
+ id :
205
+ fromClass : App\Entity\Answer
206
+ fromProperty : relatedQuestions
207
+ operations :
208
+ ApiPlatform\Metadata\GetCollection : ~
209
+ ` ` `
210
+
176
211
` ` ` xml
177
212
<resource class="App\Entity\Question" uriTemplate="/answers/{id}/related_questions.{_format}">
178
213
<uriVariables>
You can’t perform that action at this time.
0 commit comments