Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
order_by on main table
  • it would be better when ORDER in own find be on end of query ?
    bacause with relation with wheres isnt sorting correctly (i think) example from eshop
    $return = Model_Products::find('all', array(
                        'related' => array(
                            'categories',
                            'marks',
                            'variants' => array(
                                'where' => array(
                                    array( 'variants.active', 1 ),
                                ),
                                //'order_by' => array( 't0.id' => 'desc' )
                             )
                        ),
                        'where' => array(
                            array( 'active', '=', 1 ),
                            array( 'category_id', 'IN', Model_Products::categories_in($category_id) ),
                        ),
                        'limit' => $limit,
                        'offset' => $offset,
                        'order_by' => array( 'id' => 'desc' )
                    ));
    

    i need sort product from newest but in this case dont work (because order is in subselect - this is right for related queries)
    (i must hack it with //commented line) IDEA - order by in main find = main table will be on end of query and sorting will be ok - i think in all cases
    I think it would not be a problem of any case where the order at the end what we think about it ? //sry for bad english
  • Looked into it, doesn't look like there was ever a good reason for this so it's solved in 1.1-dev.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion