Hi,
I am trying to run an ordering on a related select where I want to order by a related table field and then fields in the main table:
Using code similar to:
Model_Post::query()->related('comments')->order_by('comments.user_id')->order_by('publish_date');
I would expect a query to be generated with an order clause similar to:
ORDER BY comments.user_id ASC, posts.publish_data ASC
However, its ALWAYS wanting to sort the main tables columns first so I get
ORDER BY post.publish_date ASC, comments.user_id ASC
And well...thats not the ordering I want / expect to be run.
I've also tried rearranging the order I call the order_by() functions and using an array of columns to be ordered and passed these in both directions.
Does anyone know why it needs to do the sorting in this order? Or is this a bug / can someone fix it?
Thanks,
Richard
Report and discuss bugs on github, this one was reported and will be fixed once I have time for it or someone else bothers to look into it: https://github.com/fuel/orm/issues/134