原则实体经理导致页面中断 [英] Doctrine entity manager causing page to break

查看:104
本文介绍了原则实体经理导致页面中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是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 %}

可以找到压缩项目的链接 here

May you find the link to the zipped project here

推荐答案

可能是由于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应用程序/控制台服务器:运行

这篇关于原则实体经理导致页面中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆