PetkoparaCrudGeneratorBundle
PetkoparaCrudGeneratorBundle copied to clipboard
An exception occurred while executing 'SELECT COUNT(p0_.id)
I have error after of create crud to a entity, in method getTotalOfRecordsString:
An exception occurred while executing 'SELECT COUNT(p0_.id) etc.
I add $queryBuilder->resetDQLPart('orderBy') before call method getTotalOfRecordsString.
This works ok in symfony 3.2.
public function indexAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
$queryBuilder = $em->getRepository('AppProfitabilityPerFurnitureBundle:Section')->createQueryBuilder('e');
list($filterForm, $queryBuilder) = $this->filter($queryBuilder, $request);
list($sections, $pagerHtml) = $this->paginator($queryBuilder, $request);
$queryBuilder->resetDQLPart('orderBy');
$totalOfRecordsString = $this->getTotalOfRecordsString($queryBuilder, $request);
return $this->render('AppProfitabilityPerFurnitureBundle:section:index.html.twig', array(
'sections' => $sections,
'pagerHtml' => $pagerHtml,
'filterForm' => $filterForm->createView(),
'totalOfRecordsString' => $totalOfRecordsString,
));
}