Symfony2 doctrine2数组数据可用,并在Twig文件中工作,但呈现为空白页

时间:2022-09-16 06:45:01

I'm getting datas from MySQL database but not display in rendered TWIG file. in TWIG file, I execute Twig's dump() function It works, all datas displayed but TWIG is empty.

我从MySQL数据库获取数据但不在渲染的TWIG文件中显示。在TWIG文件中,我执行Twig的dump()函数它工作,显示所有数据但TWIG为空。

    $em = $this->getDoctrine()->getEntityManager();
    $yorumlar = $em->getRepository('SiteSiteBundle:Yorum')->find($id);

    if (!$yorumlar) {
        throw $this->createNotFoundException($id . ' nolu Yorum bulunamadı!');
    }

    return $this->render('SiteSiteBundle:Default:liste.html.twig', array(
                'yorumlar' => $yorumlar
    ));

1 个解决方案

#1


1  

Just acces to your propertie. Using var_dumpt, print_r or any dump function in a managed entity could crash or marke verry slow you php server because it will try to dump you entity doctrine and all his dependancies maybe the container...

只需访问您的财产。使用var_dumpt,print_r或托管实体中的任何转储功能可能会崩溃或破坏你的PHP服务器,因为它会尝试转储你的实体主义,他所有的依赖可能是容器......

{{ yorumlar.yourPorpertie }}

#1


1  

Just acces to your propertie. Using var_dumpt, print_r or any dump function in a managed entity could crash or marke verry slow you php server because it will try to dump you entity doctrine and all his dependancies maybe the container...

只需访问您的财产。使用var_dumpt,print_r或托管实体中的任何转储功能可能会崩溃或破坏你的PHP服务器,因为它会尝试转储你的实体主义,他所有的依赖可能是容器......

{{ yorumlar.yourPorpertie }}