@@ -41,19 +41,6 @@ public function findByOptions($options = array()) {
4141
4242 $ qb = $ this ->createQueryBuilder ('a ' )
4343 ->join ('DataDog\AuditBundle\Entity\Association ' , 'aa ' , 'WITH ' , 'aa = a.source ' );
44-
45- // Totals Count
46- $ totalLogsQb = clone $ qb ;
47- $ totalLogsQb ->select ('COUNT(a.id) ' );
48- $ totalCountQuery = $ totalLogsQb ->getQuery ();
49-
50- try {
51- $ totalLogsCount = $ totalCountQuery ->getSingleScalarResult ();
52- } catch (NoResultException $ e ) {
53- $ totalLogsCount = 0 ;
54- } catch (NonUniqueResultException $ e ) {
55- $ totalLogsCount = 0 ;
56- }
5744
5845 // Apply filters
5946 foreach ($ options ["filters " ] as $ field => $ search ) {
@@ -130,18 +117,6 @@ public function findByOptions($options = array()) {
130117 $ qb ->orderBy ($ options ["sortBy " ], $ options ["orderBy " ]);
131118 }
132119
133- $ countQb = clone $ qb ;
134- $ countQb ->select ('COUNT(a.id) ' );
135- $ countQuery = $ countQb ->getQuery ();
136-
137- try {
138- $ logsCount = $ countQuery ->getSingleScalarResult ();
139- } catch (NoResultException $ e ) {
140- $ logsCount = 0 ;
141- } catch (NonUniqueResultException $ e ) {
142- $ logsCount = 0 ;
143- }
144-
145120 $ resultQuery = $ qb ->getQuery ();
146121 if (isset ($ options ["_paginate " ]) && $ options ["_paginate " ] == true ) {
147122 if (null !== $ options ["limit " ])
@@ -154,12 +129,7 @@ public function findByOptions($options = array()) {
154129
155130 return array (
156131 "draw " => intval ( $ options ["draw " ] ),
157- "recordsTotal " => $ totalLogsCount ,
158- "recordsFiltered " => $ logsCount ,
159132 'data ' => $ logs ,
160- "pagination " => array (
161- "more " => $ logsCount > ($ options ["start " ] + $ options ["limit " ]),
162- )
163133 );
164134
165135 }
0 commit comments