我的问题是,当我使用循环时,里面的数据没有显示出来,这是这里的代码,我使用了循环甚至“mes精品店”没有显示, , only "shirts & tops" show up
and this function where im calling this template in the controller
发布于 2016-04-04 10:41:54
您的函数affichDQL()肯定有问题,您应该使用dump($enseignes);在控制器中测试结果,以查看是否有结果。您也可以使用{% dump(enseignes) %}在您的小树枝中添加检查
发布于 2016-04-04 12:46:52
您的模板看起来没问题。问题可能出在可能返回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;希望这对你有所帮助
https://stackoverflow.com/questions/36392185
复制相似问题