symfony - Pagination with OrderBy and Jointure -


i've pagination problem annoying, here repository code:

public function listesujetsadmin($forum, $user, $page){     $builder = $this->createquerybuilder('s');     $builder             ->andwhere($builder->expr()->eq('s.forum', ':forum'))             ->setparameter("forum", $forum->getid())             ->addselect('c')             ->leftjoin('s.commentaires', 'c')             ->orderby('c.datecreation', 'desc')             ->addselect('l')             ->leftjoin('s.lectures', 'l', expr\join::with, $builder->expr()->eq('l.user', ':user'))             ->setparameter('user', $user->getid())             ->setfirstresult( sujet::max_par_page * ($page-1) )             ->setmaxresults( sujet::max_par_page );     return new paginator($builder); } 

if keep "->orderby('c.datecreation', 'desc')", doctrine considers every commentaires (c) has counted want count subjects (s).

this profiler shows here:

profiler

thanks !


Popular posts from this blog

html/hta mutiple file in audio player -

debugging - Reference - What does this error mean in PHP? -