I'm currently learning the basics of the FosRestBundle in a basic Symfony 3 project and am looking at creating a hyphenated REST route.
An example of a simple route I currently have, where GET /coffees
hits CoffeeController::getCoffeesAction()
as expected;
coffees:
type: rest
resource: ApiBundle\Controller\CoffeeController
I'm now looking at creating another rest controller to represent a coffee pot, so URLs follow a format like GET /coffee-pots
to hit CoffeePotsController::getCoffeePotsAction()
. I've tried every key I can think of whilst referencing the docs ("coffee-pots"
, coffeePots
, coffee_pots
etc) and I only ever get a 404. The rest of the configuration is correct, since if I change the key and action to just pots
it works fine.
I have successfully implemented routing annotations within the Controller (e.g. @Get("/coffee-pots", name="get_coffee_pots")
) but I'd rather avoid that unless it's a particularly bad practice to do so.
Is this possible? Thanks!