Question

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?

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top