DataSet implements Countable, IteratorAggregate

Object representing the paginated results of a Gateway query.



Creates a new data set from an array and calculates the result counts and pagination based on array size.

DataSet::__construct( array $data )


Sets the result count (that this page may be a subset of), and the total count of all possible results.

DataSet::setResultCount( integer $resultCount = null, integer $totalCount = null ): self

Returns Self: This method can be chained.


Set the page and pageSize for the data set.

DataSet::setPagination( integer $page = 1, integer $pageSize = null ): self

Returns Self: This method can be chained.


Implements \Countable, allowing the data set to be counted.

DataSet::count( ): integer

Return Value: integer


Implements IteratorAggregate, allowing this object to be looped over in a foreach.

DataSet::getIterator( ): \ArrayIterator

Return Value: \ArrayIterator


Returns the internal array of row data.

DataSet::toArray( ): array

Return Value: array


The total number of rows in the table being queried.

DataSet::getTotalCount( ): integer

Return Value: integer


The total un-paginated number of rows for this data set.

DataSet::getResultCount( ): integer

Will be less than the totalCount if the results have criteria applied.

Return Value: integer


The current page number, counting from 1.

DataSet::getPage( ): integer

Return Value: integer


The number of rows per page in this result set.

DataSet::getPageSize( ): integer

Return Value: integer


The total number of pages in this result set.

DataSet::getPageCount( ): integer

Return Value: integer


Get the previous page number.

DataSet::getPrevPageNumber( ): integer

Return Value: integer


Get the next page number.

DataSet::getNextPageNumber( ): integer

Return Value: integer


The row number for the lower bounds of the current page.

DataSet::getPageFrom( ): integer

Return Value: integer


The row number for the upper bounds of the current page.

DataSet::getPageTo( ): integer

Return Value: integer


Returns a range of page numbers with sections collapsed into a placeholder string.

DataSet::getPaginatedRange( string $placeholder = '...', integer $midSize = 2, integer $endSize = 2 ): array

The midSize sets how many pages are displayed on either side of the current page. The endSize sets how many pages are displayed on both ends of the range.

Return Value: array


This result is a subset of the whole table if searches or filters have been applied.

DataSet::isSubset( ): boolean

Ignores paginated row counts and looks at the total results vs the total table size.

Return Value: boolean


Is the current page the first one in the data set?

DataSet::isFirstPage( ): boolean

Return Value: boolean


Is the current page the last one in the data set?

DataSet::isLastPage( ): boolean

Return Value: boolean


Extract a single row from the result set as an array.

DataSet::getRow( string $index ): array

Return Value: array


Extract a single column from the result set as an array.

DataSet::getColumn( string $columnName ): array

Return Value: array


Joins a column of data to the result set based on a common key in both data.

DataSet::joinColumn( string $keyName, string $columnName, array &$columnData )


Transform a data set by applying a callback to each row.

DataSet::transform( callable $callable )

Last updated : September 15, 2018 b92362d