Pregunta

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
¿Fue útil?

Solución

Doctrine doesn't support | but supports BIT_OR()

Solution :

SELECT s FROM FooBundle:Status s WHERE BIT_OR(s.isGenerated, s.isGeneratable)=:flag
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top