Skip to content

Commit 7d16498

Browse files
Documentation fix for subresource custom path.
I was having problems with adding custom path name for subresource operation. I've followed suggestions from [this comment](api-platform/api-platform#1581 (comment)) and it worked fine, so I am proposing a change to the documentation.
1 parent 29ecc0b commit 7d16498

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/subresources.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,15 @@ may use `bin/console debug:router`.
178178

179179
## Using Custom Paths
180180

181-
You can control the path of subresources with the `path` option of the `subresourceOperations` parameter:
181+
You can control the path of subresources with the `path` option of the `subresourceOperations` parameter. Notice that you don't have to use the prefix `api_questions_` because it's an operation name:
182182

183183
```php
184184
<?php
185185
// api/src/Entity/Question.php
186186
187187
#[ApiResource(
188188
subresourceOperations: [
189-
'api_questions_answer_get_subresource' => [
189+
'answer_get_subresource' => [
190190
'method' => 'GET',
191191
'path' => '/questions/{id}/all-answers',
192192
],

0 commit comments

Comments
 (0)