I discovering symfony3, but im stuck at getting the parameters passed with a link from an action. In my twig file, im redirecting the user to an action:
<td><a href="{{ path('esprit_park_affiche', {'id': voiture.id, 'serie': voiture.serie, 'dateMise': voiture.dateMiseCirculation, 'marque': voiture.marque}) }}" target="_blank">go to</a></td>
And im my action, i'm trying to get the id with:
/**
* @Route("/AfficheDetail", name="esprit_park_affiche")
*/
public function afficheAction()
{
$id = $this->getParameter("id");
return $this->render("@EspritPark/Voiture/affiche.html.twig", array("id" => $id));
}
but each time i get: The parameter "id" must be defined.
like the getParameter isnt returning anything.
I even tried with:
$id = $this->get("request")->get("id");
but i get: You have requested a non-existent service "request". Did you mean one of these: "monolog.logger.request", "request_stack", "router.request_context", "data_collector.request"?