教义实体管理器导致页面中断
我是 Symfony2 的新手,并试图显示一个页面列出实体的项目.但是,一旦我使用下面的代码,分页符会出现未收到数据错误"或ERR_EMPTY_RESPONSE"导致我认为我的路线不起作用并引发问题 这里 但问题与 Doctrine 有关:
I'm new to Symfony2 and trying to display a page listing items of an entity. However, once i use the code below the page breaks with a "No data received error" or "ERR_EMPTY_RESPONSE" leading me to think that my routes were not working and raising the issue here but the issue was related to Doctrine:
public function indexAction() {
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository('ApsaBundle:Apsa')->findAll();
return $this->render('ApsaBundle:Apsa:index.html.twig', array(
'entities' => $entities,
));
但是,这个简单的函数显示页面:
However, this simple function displays the page :
public function indexAction() {
return $this->render('ApsaBundle:Apsa:index.html.twig');
}
我很高兴知道如何调试这个教义问题.在树枝下面用来显示页面
i'll be glad to know how to go about debugging this doctrine issue.Below the twig use to display the page
{% extends ::base.html.twig %}
{% block body -%}
Apsa list
<table class="records_list">
<thead>
<tr>
<th>Id</th>
<th>Titre</th>
<th>Description</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for entity in entities %}
<tr>
<td><a href="#">{{ entity.id }}</a></td>
<td>{{ entity.titre }}</td>
<td>{{ entity.description }}</td>
<td>
<ul>
<li>
<a href="#">show</a>
</li>
<li>
<a href="#">edit</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<ul>
<li>
<a href="#">
Create a new entry
</a>
</li>
</ul>
{% endblock %}
您能否在此处
推荐答案
可能是由于 WAMP 配置错误.
Probably due to a bad WAMP configuration.
我邀请您尝试使用此命令行可用的内置 symfony 服务器:
I invite you to try with the build-in symfony server available by this command line:
php 应用程序/控制台服务器:运行
相关文章