Hi, since subqueries hasn't been supported in phql, I need to sort my pagination items in PHP. I've done like this code below. It worked, but it uses iterator_to_array which dumps the Resultset to array. Is there more efficient, less memory usage other than this approach?
namespace BI;
class PradSorter {
    public static function cmp($a, $b){
        if($a->row_count == $b->row_count)
            return 0;
        return $a->row_count > $b->row_count ? +1 : -1;
    }
    public static function sort(\Phalcon\Mvc\Model\Resultset $x){
        $x = iterator_to_array($x);
        usort($x, ['\BI\PradSorter', 'cmp']);
        return $x;
    }
}