3
我想在教义添加CONCAT在ORDERBY功能2.主义查询生成器CONCAT在GROUP BY
试图在学说文档搜索和网络中浏览,但无法找到该
下面语法的解决方案抛出一个错误
$qb = $this->createQueryBuilder("t");
$qb->addOrderBy('CONCAT(tep.echtgenootNaam,tep.eigennaam)', $direction);
我想在教义添加CONCAT在ORDERBY功能2.主义查询生成器CONCAT在GROUP BY
试图在学说文档搜索和网络中浏览,但无法找到该
下面语法的解决方案抛出一个错误
$qb = $this->createQueryBuilder("t");
$qb->addOrderBy('CONCAT(tep.echtgenootNaam,tep.eigennaam)', $direction);
我不认为你可以在addOrder表达式中有CONCAT。但是,你可以执行类似的东西:
$qb->addOrderBy('tep.echtgenootNaam', $direction);
$qb->addOrderBy('tep.eigennaam', $direction);
$qb->addSelect("CONCAT(col1, col2...) AS HIDDEN cat")
->orderBy("cat")
对于这个工作,你需要安装DoctrineExtensions。