简体   繁体   English

原则DQL“包含或”

[英]Doctrine DQL “inclusive or”

I would like to know if there is a way to achieve a simple " inclusive or " in Doctrine DQL ? 我想知道是否有一种方法可以在Doctrine DQL中实现简单的“ 包容性”或包容性 ”?

I can do the following in MySQL 我可以在MySQL中执行以下操作

SELECT * FROM Status WHERE `isGenerated`|`isGeneratable`=:flag;

or 要么

SELECT * FROM Status WHERE :flag IN (`isGenerated`,`isGeneratable`);

But neither of these work in DQL 但是这些都不在DQL中起作用

Solution can't answer my own question yet :/ 解决方案还不能回答我自己的问题:/

SELECT s FROM FooBundle:Status s WHERE BIT_OR(s.isGenerated,s.isGeneratable)=:flag

Doctrine doesn't support | 教义不支持| but supports BIT_OR() 但支持BIT_OR()

Solution : 解决方案

SELECT s FROM FooBundle:Status s WHERE BIT_OR(s.isGenerated, s.isGeneratable)=:flag

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM