Skip to content
Advertisement

Doctrine 2 Query Builder abs Function

This Work:

This Don’t Work:

The Error:

Syntax Error] line 0, col 118: Error: Expected end of string, got ‘(‘

The native doctrine function abs work only on a select part of statment and don’t work on order by part.

Obs:

1-) Im avoiding to use NativeQuery.

2-) u.code is a varchar fild on mysql and need to be varchar ( some times numeric and some times string), and i need to order then like a number in numeric case.

Any Help?

Advertisement

Answer

Solved atma thank’s abs() realy doesn’t work directly in orderBy but as an alias.

soluction

Obs: It’s a doctrine limitation, not a mysql limitation, mysql suports abs direct on order by part.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement