سؤال

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