-
-
Notifications
You must be signed in to change notification settings - Fork 101
Closed
Description
Full details here http://stackoverflow.com/questions/33900219/doctrine2-symfony2-paginator-fails-with-orderby
Essentially this simple code fails
$builder = $this->createQueryBuilder("s");
$builder->addOrderBy("s.name", "ASC");
$pagi = new Paginator($builder->getQuery(), true);
$data = $pagi->getIterator()->getArrayCopy();
With the following error
SQLSTATE[HY000]: General error: 3065 Expression #1 of ORDER BY clause is not in SELECT list, references column 'dctrn_result.name_5' which is not in SELECT list; this is incompatible with DISTINCT") in AppBundle:Schools/Search:results_list.html.twig at line 33.
The name
column exists, and renaming the reference from s.name
to name
fails too.
Removing the addOrderBy
results in a successful fetch too. So the issue is certainly related to using addOrderBy
with a Doctrine2 Paginator.
Metadata
Metadata
Assignees
Labels
No labels