Accessing the Data
There are several ways to access the dataset’s data. Note that all data is returned by reference, so altering the data is entirely possible.
function empty() : bool;
Returns true
if the dataset is empty.
function count() : int;
Returns the number of records in the dataset. Also usable as count($set)
.
function fetch() : array;
Fetch the entire dataset. The returned array contains all records of the dataset, with the keys being the keys of the master dataset.
function first() : ?object;
Fetch the first element of the dataset. This is the element with the lowest key value. If the dataset is empty, null
is returned.
function last() : ?object;
Fetch the last element of the dataset. This is the element with the highest key value. If the dataset is empty, null
is returned.
function skip(int $n) : Dataset;
Skip the first $n records, and return a Dataset with the remaining records.
function limit(int $n) : Dataset;
Limit the dataset to the first $n records, and return a Dataset with these records.
function keys() ; array;
Return all keys of this dataset. The keys are always the same keys as the master dataset.