ListModel
Interface for models that provide a list of documents or items.
This interface defines a method to retrieve all documents from a model as an array. It is suitable for cases where the dataset is small enough to be loaded entirely into memory.
Tags
Table of Contents
Methods
- list() : array<string|int, mixed>
- Returns a collection of items from the model.
Methods
list()
Returns a collection of items from the model.
public
list([array<string|int, mixed> $init = [] ]) : array<string|int, mixed>
Retrieves all documents as an array. For large datasets, consider using a streaming approach (e.g., StreamModel) to avoid high memory usage.
Parameters
- $init : array<string|int, mixed> = []
-
Optional configuration array.
Return values
array<string|int, mixed> —An array of documents or items. The structure and type of each item depend on the model implementation.