From d7a85224d1eb14318e4258411c70b55ccdf5a2dc Mon Sep 17 00:00:00 2001 From: Samir Compres Date: Mon, 13 Jan 2020 14:03:01 -0500 Subject: [PATCH] Removing count in pagination --- .../Repository/AuditLogRepository.php | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/src/DataDog/AuditBundle/Repository/AuditLogRepository.php b/src/DataDog/AuditBundle/Repository/AuditLogRepository.php index ee5a2d4..f467859 100755 --- a/src/DataDog/AuditBundle/Repository/AuditLogRepository.php +++ b/src/DataDog/AuditBundle/Repository/AuditLogRepository.php @@ -41,19 +41,6 @@ public function findByOptions($options = array()) { $qb = $this->createQueryBuilder('a') ->join('DataDog\AuditBundle\Entity\Association', 'aa', 'WITH', 'aa = a.source'); - - // Totals Count - $totalLogsQb = clone $qb; - $totalLogsQb->select('COUNT(a.id)'); - $totalCountQuery = $totalLogsQb->getQuery(); - - try { - $totalLogsCount = $totalCountQuery->getSingleScalarResult(); - } catch (NoResultException $e) { - $totalLogsCount = 0; - } catch (NonUniqueResultException $e) { - $totalLogsCount = 0; - } // Apply filters foreach($options["filters"] as $field => $search) { @@ -130,18 +117,6 @@ public function findByOptions($options = array()) { $qb->orderBy($options["sortBy"], $options["orderBy"]); } - $countQb = clone $qb; - $countQb->select('COUNT(a.id)'); - $countQuery = $countQb->getQuery(); - - try { - $logsCount = $countQuery->getSingleScalarResult(); - } catch (NoResultException $e) { - $logsCount = 0; - } catch (NonUniqueResultException $e) { - $logsCount = 0; - } - $resultQuery = $qb->getQuery(); if(isset($options["_paginate"]) && $options["_paginate"] == true) { if(null !== $options["limit"]) @@ -154,12 +129,7 @@ public function findByOptions($options = array()) { return array( "draw" => intval( $options["draw"] ), - "recordsTotal" => $totalLogsCount, - "recordsFiltered" => $logsCount, 'data' => $logs, - "pagination" => array( - "more" => $logsCount > ($options["start"] + $options["limit"]), - ) ); }