I would like to know if there is a way to achieve a simple "inclusive or" in Doctrine DQL ?

I can do the following in MySQL

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

or

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

But neither of these work in 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()

Solution :

SELECT s FROM FooBundle:Status s WHERE BIT_OR(s.isGenerated, s.isGeneratable)=:flag
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top