Backend\Widgets\Table\DataSourceBase

Overview

Base class for the Table widget data sources.


Protected Properties

protected string $keyColumn

Specifies a name of record's key column

protected integer $offset

Internal record offset


Public Methods

public construct()

public construct(string $keyColumn = 'id'): void

Class constructor.

public getCount()

public getCount(): integer 

Returns a total number of records in the data source.

public getRecords()

public getRecords(integer $offset, integer $count): array 

Return records from the data source.

public initRecords()

public initRecords(array $records): void

Initializes records in the data source. The method doesn't replace existing records and could be called multiple times in order to fill the data source.

public purge()

public purge(): void

Removes all records from the data source.

public readRecords()

public readRecords(integer $count = 10): array 

Returns a set of records from the data source.

public reset()

public reset(): void

Rewinds the the data source to the first record. Use this method with the readRecords() method.

public searchRecords()

public searchRecords($query, $offset, $count): void

Identical to getRecords except provided with a search query.