Question

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
Était-ce utile?

La solution

Doctrine doesn't support | but supports BIT_OR()

Solution :

SELECT s FROM FooBundle:Status s WHERE BIT_OR(s.isGenerated, s.isGeneratable)=:flag
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top