DataSet

DataSet implements Countable, IteratorAggregate

Object representing the paginated results of a Gateway query.

Methods

__construct

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

DataSet::__construct( array $data )

setResultCount

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.


setPagination

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.


count

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

DataSet::count( ): integer

Return Value: integer


getIterator

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

DataSet::getIterator( ): \ArrayIterator

Return Value: \ArrayIterator


toArray

Returns the internal array of row data.

DataSet::toArray( ): array

Return Value: array


getTotalCount

The total number of rows in the table being queried.

DataSet::getTotalCount( ): integer

Return Value: integer


getResultCount

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


getPage

The current page number, counting from 1.

DataSet::getPage( ): integer

Return Value: integer


getPageSize

The number of rows per page in this result set.

DataSet::getPageSize( ): integer

Return Value: integer


getPageCount

The total number of pages in this result set.

DataSet::getPageCount( ): integer

Return Value: integer


getPrevPageNumber

Get the previous page number.

DataSet::getPrevPageNumber( ): integer

Return Value: integer


getNextPageNumber

Get the next page number.

DataSet::getNextPageNumber( ): integer

Return Value: integer


getPageFrom

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

DataSet::getPageFrom( ): integer

Return Value: integer


getPageTo

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

DataSet::getPageTo( ): integer

Return Value: integer


getPaginatedRange

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


isSubset

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


isFirstPage

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

DataSet::isFirstPage( ): boolean

Return Value: boolean


isLastPage

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

DataSet::isLastPage( ): boolean

Return Value: boolean


getRow

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

DataSet::getRow( string $index ): array

Return Value: array


getColumn

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

DataSet::getColumn( string $columnName ): array

Return Value: array


joinColumn

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

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

DataSet::transform( callable $callable )