You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: core/operations.md
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -271,6 +271,19 @@ class Question
271
271
}
272
272
```
273
273
274
+
Alternatively, you can use the YAML configuration format:
275
+
276
+
```yaml
277
+
AppBundle\Entity\Answer: ~
278
+
AppBundle\Entity\Question:
279
+
properties:
280
+
answer:
281
+
subresource:
282
+
resourceClass: 'AppBundle\Entity\Answer'
283
+
collection: false
284
+
```
285
+
286
+
274
287
Note that all we had to do is to set up `@ApiSubresource` on the `Question::answer` relation. Because the `answer` is a to-one relation, we know that this subresource is an item. Therefore the response will look like this:
0 commit comments