Closed AyhamAlzoubi closed 4 years ago
i think the relevant code is somewhere around here: https://github.com/FriendsOfSymfony/FOSRestBundle/blob/master/Routing/Loader/Reader/RestActionReader.php#L410
though i guess such changes may then require a BC flag to prevent code from breaking
Here I am pluralizing the route in any case and seems fine Can you have a look please?
// if we have argument for current resource, then it's object.
// otherwise - it's collection
if (isset($arguments[$i])) {
if (null !== $resource) {
$urlParts[] =
strtolower($this->inflector->pluralize($resource))
.'/{'.$arguments[$i]->getName().'}';
} else {
$urlParts[] = '{'.$arguments[$i]->getName().'}';
}
} elseif (null !== $resource) {
$urlParts[] = $this->inflector->pluralize(strtolower($resource));
}
To integrate:
postCustomerAction
, and it seems that postCustomersAction
will still work ( @lsmith77 didnt test it throughly though )POST /customers
This way we can provide consistency to the routing and to the action naming, even though Im not sure if there is any unhandled special case @AyhamAlzoubi is forgetting about...
failing cases:
/customers/passwords/...
i suggest you open a PR with any changes ..
ping
Closing as automatic route generation is deprecated: #1954
Hey I am using FostRestBundle with Symfony2
I want to use the route /users/{id} with methods PUT, POST, DELETE
I have the actions:
can't we have it as:
deleteUserAction($id)
with the same route /users/{id} because it makes sense to have one user has this $idthis works only for PUT but not for POST and DELETE ?