From 8663ebbacc80d714fc3b6e557156782dcd724fce Mon Sep 17 00:00:00 2001 From: Takashi Kanemoto Date: Wed, 26 Jul 2023 16:17:38 +0900 Subject: [PATCH] docs(subresources): add yaml examples --- core/subresources.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/core/subresources.md b/core/subresources.md index 3e8a98c6253..ef240f2c4a6 100644 --- a/core/subresources.md +++ b/core/subresources.md @@ -81,6 +81,13 @@ class Question } ``` +```yaml +# api/config/api_platform/resources.yaml +resources: + App\Entity\Answer: ~ + App\Entity\Question: ~ +``` + ```xml @@ -129,6 +136,21 @@ class Answer } ``` +```yaml +# api/config/api_platform/resources.yaml +resources: + App\Entity\Answer: + uriTemplate: /questions/{id}/answer + uriVariable: + id: + fromClass: App\Entity\Question + fromProperty: answer + operations: + ApiPlatform\Metadata\Get: ~ + + App\Entity\Question: ~ +``` + ```xml