Interface Yiisoft\Data\Reader\DataReaderInterface
Data reader is a data source that can do the following with data items:
- Read
- Skip a number of items from the beginning
- Count
- Sort
- Filter
- Iterate with foreach
Public Methods
Method Details
| public abstract integer count ( ) | ||
| return | integer |
Number of items in the data. |
|---|---|---|
public function count(): int;
Defined in: Yiisoft\Data\Reader\FilterableDataInterface::getFilter()
Get current data reading criteria.
| public abstract Yiisoft\Data\Reader\FilterInterface getFilter ( ) | ||
| return | Yiisoft\Data\Reader\FilterInterface |
Data reading criteria. |
|---|---|---|
public function getFilter(): FilterInterface;
Defined in: Yiisoft\Data\Reader\LimitableDataInterface::getLimit()
Get current limit.
| public abstract integer|null getLimit ( ) | ||
| return | integer|null |
Limit. |
|---|---|---|
public function getLimit(): ?int;
Defined in: Yiisoft\Data\Reader\OffsetableDataInterface::getOffset()
Get current offset.
| public abstract integer getOffset ( ) | ||
| return | integer |
Offset. |
|---|---|---|
public function getOffset(): int;
Defined in: Yiisoft\Data\Reader\SortableDataInterface::getSort()
Get a current sorting criteria.
| public abstract Yiisoft\Data\Reader\Sort|null getSort ( ) | ||
| return | Yiisoft\Data\Reader\Sort|null |
Current sorting criteria or null for no sorting. |
|---|---|---|
public function getSort(): ?Sort;
Defined in: Yiisoft\Data\Reader\ReadableDataInterface::read()
Get iterable for the data set.
| public abstract iterable read ( ) | ||
| return | iterable |
Iterable for the data. Note that keys could be anything so you shouldn't rely on these. |
|---|---|---|
public function read(): iterable;
Defined in: Yiisoft\Data\Reader\ReadableDataInterface::readOne()
Get one item from the data set. Which item is returned is up to implementation.
Note that invoking this method doesn't impact the data set or its pointer.
| public abstract array|object|null readOne ( ) | ||
| return | array|object|null |
An item or null if there is none. |
|---|---|---|
public function readOne(): array|object|null;
Defined in: Yiisoft\Data\Reader\FilterableDataInterface::withFilter()
Returns new instance with data reading criteria set.
| public abstract Yiisoft\Data\Reader\DataReaderInterface withFilter ( Yiisoft\Data\Reader\FilterInterface $filter ) | ||
| $filter | Yiisoft\Data\Reader\FilterInterface |
Data reading criteria. |
| return | Yiisoft\Data\Reader\DataReaderInterface |
New instance. |
|---|---|---|
public function withFilter(FilterInterface $filter): static;
Defined in: Yiisoft\Data\Reader\LimitableDataInterface::withLimit()
Get a new instance with the limit set.
| public abstract Yiisoft\Data\Reader\DataReaderInterface withLimit ( integer|null $limit ) | ||
| $limit | integer|null |
Limit. |
| return | Yiisoft\Data\Reader\DataReaderInterface |
New instance. |
|---|---|---|
| throws | InvalidArgumentException |
If the limit is less than zero. |
public function withLimit(?int $limit): static;
Defined in: Yiisoft\Data\Reader\OffsetableDataInterface::withOffset()
Get a new instance with an offset set.
| public abstract $this withOffset ( integer $offset ) | ||
| $offset | integer |
Offset. |
| return | $this |
New instance. |
|---|---|---|
public function withOffset(int $offset): static;
Defined in: Yiisoft\Data\Reader\SortableDataInterface::withSort()
Get a new instance with a sorting set.
| public abstract Yiisoft\Data\Reader\DataReaderInterface withSort ( Yiisoft\Data\Reader\Sort|null $sort ) | ||
| $sort | Yiisoft\Data\Reader\Sort|null |
Sorting criteria or null for no sorting. |
| return | Yiisoft\Data\Reader\DataReaderInterface |
New instance. |
|---|---|---|
public function withSort(?Sort $sort): static;
Signup or Login in order to comment.