これが特定の最初の運動を見つける関数ですlessonid
public function exerciseAction($lessonid, $exercise)
{
$em = $this->getDoctrine()->getEntityManager();
$exercise = $em->getRepository('PrezentariPrezentariBundle:Exercise')->findOneByLesson($lessonid);
return $this->render('PrezentariPrezentariBundle:Page:exercise.html.twig', array(
'exercise' => $exercise,
'lessonid' => $lessonid,
));
}
ここでは、演習を1つずつ実行する関数を実装してみます
public function exercisePagerAction($exercise)
{
$em = $this->getDoctrine()->getEntityManager();
$nextExercise= $em->getRepository('PrezentariPrezentariBundle:Exercise')->getNext($exercise);
return $this->render('PrezentariPrezentariBundle:Page:exercise.html.twig', array(
'exercise' => $nextExercise,
));
}