【发布时间】:2016-07-23 09:02:31
【问题描述】:
我的问题是,当我使用循环时,里面的数据不显示, 这是我使用循环的代码,即使“mes Boutiques”也不显示, , only "shirts & tops" show up
and this function where im calling this template in the controller
【问题讨论】:
标签: css symfony templates view controller
我的问题是,当我使用循环时,里面的数据不显示, 这是我使用循环的代码,即使“mes Boutiques”也不显示, , only "shirts & tops" show up
and this function where im calling this template in the controller
【问题讨论】:
标签: css symfony templates view controller
您的模板看起来不错。问题可能出在可能返回 DQL 的存储库方法中:表示 Doctrine 中查询的字符串。
我怀疑你的实体方法中有这样的方法:
// retrieve the DQL string of what was defined in QueryBuilder
$dql = $qb->getDql();
所以你需要用这样的东西替换:
// retrieve the associated Query object with the processed DQL
$query = $qb->getQuery();
// Execute Query
$result = $query->getResult();
return $result;
希望有帮助
【讨论】:
您的函数 affichDQL() 一定有问题,您应该在控制器中使用 dump($enseignes); 测试结果看看你是否有结果。您也可以使用 {% dump(enseignes) %}
在您的树枝中添加检查【讨论】: