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

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

问题描述

解决方案

是否可以使用索引与doctrine 2查询构建器,如果是,那么什么是正确的语法? >在使用querybuilder时,使用手动注入索引子句 - >

 (您是querybuilder语句)
$ q = $ q-> getQuery() - > setDQL(str_replace('WHERE','INDEX BY yourIndexValue WHERE',$ q-> getDQL()));

这似乎适用于我...


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

解决方案

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()));

This seems to work for me...

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

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