Prefix root resource's route_prefix to sub-resources#2294
Prefix root resource's route_prefix to sub-resources#2294dunglas merged 1 commit intoapi-platform:2.3from silverbackdan:patch/subresource-route-prefix
Conversation
Unit test also added
| $operation['operation_name'] | ||
| ); | ||
|
|
||
| $prefix = trim(trim($rootResourceMetadata->getAttribute('route_prefix', '')), '/'); |
There was a problem hiding this comment.
we don't need the first trim imo
There was a problem hiding this comment.
This is lifted straight from here https://github.com/api-platform/core/blob/master/src/Bridge/Symfony/Routing/ApiLoader.php#L204 - do you think I should adjust both or is there another reason why you think both trims aren't needed here? Also would you mind clarifying if you mean the inner or outer trim when you say 'first'?
There was a problem hiding this comment.
Better keep both, but I think that the inner one is less usefull.
Pretty sure that some users use "route_prefix"="/foo" or "route_prefix"="foo/" and setting "route_prefix"="/" would be strange but would not have impact at least.
|
Thanks both @soyuka and @antograssiot |
|
Thanks @silverbackdan! |
I think this is a bug, sorry if it isn't. This will make a sub-resource have the same route_prefix as the root resource. Is this the expected behaviour?