原则ODM查询为NULL [英] Doctrine ODM Query IS NULL
本文介绍了原则ODM查询为NULL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Doctrine ODM查询中是否可以使用 IS NULL
?我发现的唯一东西是 fieldIsset()
,它会生成 IS NOT NULL
,但是我无法对其求反.我累了
Is it possible to use IS NULL
in Doctrine ODM Query? Only thing i found is fieldIsset()
, which generates IS NOT NULL
, but i cannot negate it. I've tired
$ queryBuilder-> andWhere()->不是()-> fieldIsset('fieldSelector');
但是,结果查询为(没有文档.[fieldSelector]不为空)
.有没有人遇到类似的问题?
$queryBuilder
->andWhere()
->not()
->fieldIsset('fieldSelector');
but, resulting query is (NOT document.[fieldSelector] IS NOT NULL)
. Did anyone ran into similar problem?
推荐答案
尝试如下:
$queryBuilder
->where('fieldSelector IS NULL')
;
欢呼
编辑:
对不起,没有看到您使用ODM ...
Sorry, did not see you use ODM...
所以,也许是这样:
$queryBuilder
->field('fieldSelector')->equals(null)
;
这篇关于原则ODM查询为NULL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文