Hi,
I want to order-by a find on a Model with a Database_Expression
I've seen the post "order_by random" (http://fuelphp.com/forums/topics/view/1831) and the issue (https://github.com/fuel/orm/issues/37)
It seems that it works with DB requests but not with Model requests.
1. DB::select('*')->from('table')->order_by(DB::expr('ISNULL(table.flied)'))->execute();
2. Model_Table::find('all', array('order_by' => array(DB::expr('ISNULL(table.flied)') => 'ASC')));
3. Model_Table::find()->order_by(DB::expr('ISNULL(table.flied)'), 'ASC')->get();
1. work fine, 2. and 3. make Warning PHP and the sql have no ORDER BY
Warning for 2.
ErrorException [ Warning ]: Illegal offset type
APPPATH/classes/controller/test.php @ line 23:
23: Model_Table::find('all', array('order_by' => array(DB::expr('ISNULL(table.flied)') => 'ASC')));
Warning for 3.
ErrorException [ Warning ]: Illegal offset type
PKGPATH/orm/classes/query.php @ line 363:
363: $this->order_by[$property] = $direction;
Is there another way to do order-by with Database_Expression in Model that i have not seen ?