@@ -155,7 +155,11 @@ public function data_tables(): ?Response
155155 ],
156156 'group ' => 'report_id ' ,
157157 ];
158- $ subquery = TableRegistry::getTableLocator ()->get ('incidents ' )->find ('all ' , $ subquery_params );
158+ $ subquery = TableRegistry::getTableLocator ()->get ('incidents ' )->find (
159+ 'all ' ,
160+ fields: $ subquery_params ['fields ' ],
161+ group: $ subquery_params ['group ' ],
162+ );
159163
160164 // override automatic aliasing, for proper usage in joins
161165 $ aColumns = [
@@ -199,7 +203,12 @@ public function data_tables(): ?Response
199203 )
200204 );
201205 //$rows = Sanitize::clean($rows);
202- $ totalFiltered = $ this ->Reports ->find ('all ' , $ params )->count ();
206+ $ totalFiltered = $ this ->Reports ->find (
207+ 'all ' ,
208+ fields: $ params ['fields ' ],
209+ conditions: $ params ['conditions ' ],
210+ order: $ params ['order ' ],
211+ )->count ();
203212
204213 // change exception_type from boolean values to strings
205214 // add incident count for related reports
@@ -216,7 +225,7 @@ public function data_tables(): ?Response
216225 ];
217226 $ subquery_count = TableRegistry::getTableLocator ()->get ('incidents ' )->find (
218227 'all ' ,
219- $ subquery_params_count
228+ fields: $ subquery_params_count[ ' fields ' ],
220229 );
221230
222231 $ params_count = [
@@ -226,7 +235,11 @@ public function data_tables(): ?Response
226235 ],
227236 ];
228237
229- $ inci_count_related = $ this ->Reports ->find ('all ' , $ params_count )->innerJoin (
238+ $ inci_count_related = $ this ->Reports ->find (
239+ 'all ' ,
240+ fields: $ params_count ['fields ' ],
241+ conditions: $ params_count ['conditions ' ],
242+ )->innerJoin (
230243 ['incidents ' => $ subquery_count ],
231244 ['incidents.report_id = Reports.related_to ' ]
232245 )->count ();
0 commit comments