I am coding an API to improve my personnal PHP skills. I have a problem with 2 routes :
recette.recetteById:
path: /api/recette/{id}
controller: App\Controller\RecetteController::recetteById
recette.subRecette:
path: /api/recette/sub-recette
controller: App\Controller\RecetteController::subRecette
When I go to /api/recette/sub-recette it shows me the return of my recetteById function instead of subRecette, it seems that /sub-recette is used as /{id}.
My recetteById is just a function that returns the id as json, so when I go to /api/recette/sub-recette it show sub-recette. Why the route doesn't call my subRecette function?
What do I have to do to call subRecette function when I go /api/recette/sub-recette
recetteByID :
public function recetteById($id) {
return $this->json($id);
}
_?