It seems like there's no way to handle the "greater than" in the way I meant. The only solution I was able to find is to define my own IF function.
Doctrine: How to use "greater than" in select
-
20-07-2023 - |
Domanda
I've a query where I need to find out, if a string contains some substring. And I want to order by the result.
Here is my initial idea:
SELECT p, LOCATE(:term, p.name) > 0 inName
FROM xy p
ORDER BY inName, p.name
which lead to Error: Expected Doctrine\ORM\Query\Lexer::T_FROM, got '>'. After reading the documentation I understand why.
Is there any simple way, how to use "greater than" in select with Doctrine2?
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow