0

これが特定の最初の運動を見つける関数です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,
    ));
}
4

1 に答える 1

0

あなたの問題はここにあります:

$nextExercise= $em->getRepository('PrezentariPrezentariBundle:Exercise')->getNext($exercise);

sth を見つける必要があります。

$nextExercise= $em->getRepository('PrezentariPrezentariBundle:Exercise')->findOneById($exercise)->getNext();
于 2012-09-21T12:52:39.463 に答える