jackalope/jackalope-doctrine-dbal — pull request #226 by dantleech (2014-12-01 17:09:33+00:00)
Title: WIP allow sorting by integers

DoctrienDBAL does not currently allow sorting on integer properties. This means that when you perform an ORDER BY on a set of numbers the result may be: `10, 100, 1000, 2, 20` etc.

The best solution *would* be to use the `CAST` keyword (e.g. `ORDER BY CAST([sulu:order])`) but CAST will only ever work on static operands (e.g. `CAST('12' AS LONG)`)

My "idea" is to store the numberical properties in a separate column and sort on both of the columns when applying an order by:

````
SELECT ... WHERE ... ORDER BY
CAST(EXTRACTVALUE(int_props, '//sv:property[@sv:name="sulu:order"]/sv:value[1]') AS integer),
EXTRACTVALUE(int_props, '//sv:property[@sv:name="sulu:order"]/sv:value[1]' ASC;
````

I havn't tested yet but this should work I think. If it does the only question is the performance penalty.