Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top