1
我有兩個表Symfony2中創建左加入
1)CMS
2)cms_translations
表1)CMS
id
url
status
表2)cms_translations
object_id
title
lang_id
那麼什麼是左連接查詢在twig文件中顯示兩個表值?
,這是通過查詢我
$q = $em->createQuery("SELECT c , d FROM Dashboard\CmsBundle\Entity\Cms c
JOIN c.translations d
WITH c.id = d.object AND c.status = 1
GROUP BY c.sortOrder
ORDER BY c.sortOrder ASC "
);
完成,這是由我完成的代碼顯示在index.html.twing文件
{% for entity in enitity_cms %}
<a href="{{ path('_cmsAboutUs' , { slug : entity.url }) }}" >{{ entity.Title }}</a>
{% endfor %}
但{{ entity.Title }}
則無法打印如何在twing文件中打印cms_translations.title?
如何從第二個表中的HTML文件打印值?
'從儀表板\ CmsBundle \實體\ Cms'?真? –