DataSourceBase

Base class for the Table widget data sources.

abstract class Backend\Widgets\Table\DataSourceBase

Properties

protected $keyColumn : string

Specifies a name of record's key column

protected $offset : int

Internal record offset

Methods

public construct (string $keyColumn = "id")

Class constructor.

Parameters
Property Description
$keyColumn
string

Specifies a name of the key column.

Returns
mixed

public getCount () : int

Returns a total number of records in the data source.

Returns
int

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

Return records from the data source.

Parameters
Property Description
$offset
int

Specifies the offset of the first record to return, zero-based.

$count
int

Specifies the number of records to return.

Returns
array

Returns the records. If there are no more records, returns an empty array.

public initRecords (array $records)

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.

Parameters
Property Description
$records
array

Records to initialize in the data source.

Returns
mixed

public purge ()

Removes all records from the data source.

Returns
mixed

public readRecords (integer $count = 10) : array

Returns a set of records from the data source.

Parameters
Property Description
$count
integer

Specifies the number of records to return.

Returns
array

Returns the records. If there are no more records, returns an empty array.

public reset ()

Rewinds the the data source to the first record.

Use this method with the readRecords() method.

Returns
mixed

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

Identical to getRecords except provided with a search query.

Parameters
Property Description
$query
mixed
$offset
mixed
$count
mixed
Returns
mixed

Extended by

Class Description
ClientMemoryDataSource

The client-memory data source for the Table widget.

ServerEventDataSource

The server-event data source for the Table widget.

Copyright © 2024 Winter CMS