Search code examples
symfonydoctrine-ormdqlbitwise-or

Doctrine DQL "inclusive or"


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

Solution

  • Doctrine doesn't support | but supports BIT_OR()

    Solution :

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