php - CakePHP 3.0 - order by assocation count? -


lets have table users hasone userdata , hasmany contests.

how retrieve users pagination ordered by: 1: first ones have more 1 contest , userdata filled 2: second ones have userdata filled , no contests 3: last ones empty userdata , contests

im paginating far cant solve problem:

$this->paginate = [         'contain' => [             'userdatas',             'contests'         ],         'maxlimit' => 20,     ];      $query = $this->users->find('all');     $this->set('users', $this->paginate($query)); 


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -