Phalcon Model order by item popularity (number of appearances)
问题 I'm sure I have done something like this before, but can't find it and google not being helpful. Using Phalcon model if possible, I want to select the items from a table whose ID appears the most - i.e. 10 most popular items ordered by popularity. Is this possible using Model::find("conditions") ? I do I have to use PHQL for this? 回答1: using model::find Model::find([ 'columns' => 'id,count(id) as counter', 'group' => 'id', 'order' => 'counter DESC' ]); PHQL: $this->modelsManager->executeQuery