Skip to content
docsv0.1.0

DataSourceRequest

A query against a named {@see \Milpa\Live\Contracts\Data\DataSourceInterface}, as issued by a component (e.g. an autocomplete's search-as-you-type). `$limit` is a request, not a guarantee — a data source MAY return fewer items and MUST report via {@see DataSourceResult::$meta} whether the result was truncated.

DataSourceRequest::__construct()

public function __construct(string $source, string $componentId, string $query = '', int $limit = 20, array $filters = [], array $context = []):

Parameters

Parameters of __construct()
NameTypeDescription
$sourcestringThe target data source's name, matched via {@see \Milpa\Live\Contracts\Data\DataSourceInterface::supports()}.
$componentIdstringThe requesting component instance's id.
$querystringFree-text search term; an empty string means "no filtering by text".
$limitintMaximum number of items requested.
$filtersarray<string, mixed>Additional source-specific filter criteria beyond `$query`.
$contextarray<string, mixed>Caller-defined extra context the data source may need to resolve the query.