public function mpttLocationList() {
$q = $this->_em->createQuery("
SELECT CONCAT(REPEAT('.', COUNT(parent.region_name) - 1), node.region_name) AS name
FROM ViveListingBundle:region_redefine AS node,
ViveListingBundle:region_redefine AS parent
WHERE node.lft BETWEEN parent.lft AND parent.rgt
GROUP BY node.region_name
ORDER BY node.lft");
return $q->getResult();
}
上面的代码给出了错误:
[Syntax Error] line 0, col 23: Error: Expected known function, got 'REPEAT'.
答案 0 :(得分:0)
REPEAT
不是有效的DQL函数。记住DQL不是SQL,它看起来很相似,但它有重要的区别,不支持所有的SQL结构。查看DQL文档以查看支持的内容:
答案 1 :(得分:0)
要教授关于REPEAT()
的学说,您需要define a custom DQL function和register it with Symfony。