Doctrine 2 查询构建器和索引 [英] Doctrine 2 query builder and index by

查看:27
本文介绍了Doctrine 2 查询构建器和索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将 index by 与学说 2 查询构建器一起使用,如果可以,正确的语法是什么?

Is it possible to use index by with the doctrine 2 query builder, and if so what is the proper syntax?

推荐答案

这里是使用querybuilder时的一种解决方案,使用手动注入索引by子句-

Here's one solution when using querybuilder, using manual injection of the index by clause -

(do you querybuilder statement)
$q  = $q->getQuery()->setDQL(str_replace('WHERE', 'INDEX BY yourIndexValue WHERE', $q->getDQL()));

这似乎对我有用...

这篇关于Doctrine 2 查询构建器和索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆