Today I have an specific "issue" to solve with Kohana (3.3) orm order_by method. I need rewrite the order_by() method to accept anything like that:
->order_by("IF(ISNULL(foo) OR foo = '', 1, 0), foo", "ASC")
(This conditional put all null values in the end of query result). But, the orm escape the query with " ` " then it not work.
ORDER BY `IF(ISNULL(foo) OR foo = "", 1, 0), foo` ASC
I can mount this query using DB::query(), but I need use that conditional in all order_by query on my system.