First of all i don't get it why u don't want to do the order in the select query, in my opinion it is more neat and has a better performance then sorting in php. But since you don't want that, well i see two ways : 1- You sort your collection based on the id value : may be this could help http://www.mabishu.com/blog/2011/02/03/sort-an-array-of-object... but in your case you will be iterating a collection of objects and not an array of objects.
2- Use the toArray() method to transform everything to array and the you can use the array sort functions http://php.net/manual/fr/ref.array.php
In the end as you can see doing the sorting in php is a mess compared to doing it in sql ORDER BY id ASC (or the equivalent in Query Builder order() method)
Sign in to participate in this thread!
We'd like to thank these amazing companies for supporting us