Symfony 2: knppaginator does not allow left join -
i use knppaginator getting paginated results. when use left join statement in query, following error:
cannot count query selects 2 components, cannot make distinction
the code in controller looks this:
public function paginationaction() { $em = $this->get('doctrine.orm.entity_manager'); $dql = "select p.name, c.name mybundle:products p left join mybundle:categories c c.id = p.categoryid"; $query = $em->createquery($dql); $request = $this->getrequest(); $paginator = $this->get('knp_paginator'); $pagination = $paginator->paginate( $query, $request->query->getint('page', 1), 10 ); $viewdata['pagination'] = $pagination; return $this->render('mybundle:results.html.twig', $viewdata); }
how can make left join statement work? when leave out left join, works fine.
this question asked before. check out answer: doctrine : pagination left joins
Comments
Post a Comment