Closed CHiPs44 closed 6 years ago
Same issue and same question here :-/
Please override the OperationPathResolver service instead:
It's using an OperationType that you can compare to these constants
If you don't want plurialization, you can just create your own PathSegmentNameGenerator by implementing ApiPlatform\Core\Operation\PathSegmentNameGeneratorInterface
and set it in your config path_segment_name_generator
Not really because as they said it's always called with true
(see here) as second argument because we're always using pluralization and they want to use it only on item collections.
the POST /api/my-object/id
is totally misleading so I assumed he would expects to POST to /api/my-object
@antograssiot Yes, I made an error with POST.
I'm going to try the OperationPathResolver solution.
I retried to make this issue work with API Platform 2.3.3, without success.
I saw several occurences of "The use of the default_operation_path_resolver
has been deprecated in 2.1 and will be removed in 3.0. Use path_segment_name_generator
instead." in the source code.
As I asked this essentially for cosmetic reasons, I close this issue.
I would like to change API path to something like :
Alas, PathSegmentNameGenerator::getSegmentName seems to always be called with $collection = true.
Is there a way to solve this, or something I didn't understand?
Even if most of it should not be relevant, here is some data about my dev env :
PHP version is :