PetkoparaCrudGeneratorBundle icon indicating copy to clipboard operation
PetkoparaCrudGeneratorBundle copied to clipboard

An exception occurred while executing 'SELECT COUNT(p0_.id)

Open cesarluna opened this issue 6 years ago • 0 comments

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,

        ));
    }

cesarluna avatar Jan 23 '18 14:01 cesarluna