I have a comment table:
Comment Table : | id | post_id | ...... |
Post Table: | id | catalog_id | ...... |
Catalog Table: | id | post_id |
so, in my Post Model:
 $this->hasMany('id','Model\Comment','post_id',['alias'=>'Comment']);in my Comment Model:
$this->belongsTo('post_id','Model\Post','id',['alias'=>'Post']); what I want to implement is get the most comment Catalog NOT most comment Post.
with
paginator = new \Phalcon\Paginator\Adapter\Model([
            'data'       => $data,
            'limit'      => $this->recordPerPage,
            'page'       => $page,
        ]);But I really don't know how sort the data by the sum of another table in phalcon.