Is it possible to change the path of a subresource?
It should work just as you would overwrite the one of a collection operation.
For example:
# src/AppBundle/Resources/config/api_resources/resources.yml
AppBundle\Entity\Answer:
collectionOperations:
api_questions_answer_get_subresource:
method: 'GET' # nothing more to add if we want to keep the default controller
path: '/foo/{id}/bar'
Before you do this check debug:router to get the operation name and the identifier names (they'll have to stay the same).
When I am naming my collectionOperation to api_teams_users_get_subresource then it will be called api_teams_api_teams_users_get_subresource_collection in the router.
Mhh I need to change the docs on this it艣 s actually only the suffix. Just like you're doing to replace a collection operation (ie get, put) here it's property_get_subresource:
For example to replace the api_users_person_get_subresource_collection path I did:
collectionOperations:
person_get_subresource:
method: 'GET'
path: '/foo/{id}/bar'
The problem is that i don't want to change the api_users_person_get_subresource_collection.
I want change the api_users_person_get_subresource and that's unfortunaley not possible at all :(
Okaaayy. My bad thought this was fine!
So, the correct way was your first opinion?
# src/AppBundle/Resources/config/api_resources/resources.yml
AppBundle\Entity\Answer:
collectionOperations:
api_questions_answer_get_subresource:
method: 'GET' # nothing more to add if we want to keep the default controller
path: '/foo/{id}/bar'
answer_get_subresource is the operation name
Most helpful comment
answer_get_subresourceis the operation name