我想從數據庫查找所有值($ id)的作品,但是當我嘗試使用FindAll()它顯示我下面的錯誤。 雖然退出(\ Doctrine \ Common \ Util \ Debug :: dump($ questions)),此命令會從數據庫生成所有值。 我的錯誤是,當我運行程序它顯示我用於與鍵陣列 密鑰「問題」,「0,1,2,3」不存在AcmeABundle:默認:view.html.twig查看數據庫值使用FindAll()Symfony2
我的觀點.html.twig文件
{% extends 'AcmeABundle:Default:index.html.twig' %}
{% block content %}
<ul>
{% for quiz_table in questions %}
<li> {{ questions.question }}
{{ questions.choice1 }}
{{ questions.choice2 }}
{{ questions.choice3 }}
{{ questions.answer }}
</li>
{% endfor %}
</ul>
</div>
{% endblock %}
我的控制器
public function showAction()
{
$repository=$this->getDoctrine()->getRepository('AcmeQuizBundle:QuizTable');
$questions=$repository->findAll();
return $this->render('AcmeQuizBundle:Default:view.html.twig',array(
'questions'=>$questions
)
);
}
我的錯誤是,當我運行程序它示出了用於與鍵「0,1陣列我密鑰「問題」 ,2,3「在AcmeABundle中不存在:默認值:view.html.twig – Anonymous