Skip to content
Permalink
Browse files

fix(Pagination): Allow passing query options in to paginate

  • Loading branch information
elpete committed Feb 7, 2020
1 parent 1b0f82a commit cdecfb36f5acab87edd3a478c570f77d285df554
Showing with 12 additions and 2 deletions.
  1. +12 −2 models/Query/QueryBuilder.cfc
@@ -1709,9 +1709,19 @@ component displayname="QueryBuilder" accessors="true" {
return this;
}

public any function paginate( numeric page = 1, numeric maxRows = 25 ) {
/**
* Executes the configured query for the given page and maxRows.
* A pagination collector will be returned with the results.
*
* @page The page of results to return.
* @maxRows The number of rows to return.
* @options Any options to pass to `queryExecute`. Default: {}.
*
* @return PaginationCollector
*/
public any function paginate( numeric page = 1, numeric maxRows = 25, struct options = {} ) {
var totalRecords = count();
var results = forPage( page, maxRows ).get();
var results = forPage( page, maxRows ).get( options = options );
return getPaginationCollector().generateWithResults(
totalRecords = totalRecords,
results = results,

0 comments on commit cdecfb3

Please sign in to comment.
You can’t perform that action at this time.