Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

sort relation model count yii2

$query = Folder::find()->joinWith(['documents'])->orderBy(['COUNT(documents.id)' => SORT_ASC])->groupBy('folder.id');
 
PREVIOUS NEXT
Tagged: #sort #relation #model #count
ADD COMMENT
Topic
Name
4+8 =