I just create my first app in symfony and i have a problem with routing.
/**
* @Route("/todo/details/{id}", name="todo_details")
*/
public function detailsAction($id){
$todo = $this->getDoctrine()
->getRepository('AppBundle:Todo')
->find($id);
return $this->render('todo/details.html.twig', array(
'todo' => $todo
));
}
I have code as this above. The problem is in {id}, because in my database i have three task and it's not matter that i click I always get the first. To show another i must change it manually.
Now i observed another problem. When i delete all task and create two new i have new id's for them. Is that situation is correct?