Skip to content
docsv0.1.0

DataSourceInterface

A named source of list data (e.g. for an autocomplete or data table) a component can query at request time. Implementations are looked up by name through a {@see DataSourceRegistryInterface} rather than injected directly, so a component's markup/props can name a data source without the component needing a compile-time dependency on it.

DataSourceInterface::supports()

abstract public function supports(string $source): bool

Whether this data source answers to the given `source` name. Used by {@see DataSourceRegistryInterface::resolve()} to dispatch by name instead of every call site hand-wiring a specific source.

Parameters

Parameters of supports()
NameTypeDescription
$sourcestring

DataSourceInterface::resolve()

abstract public function resolve(Milpa\Live\ValueObjects\DataSourceRequest $request): Milpa\Live\ValueObjects\DataSourceResult

Resolves the request (query/filters/pagination) against this data source's underlying data and returns the matching items.

Parameters

Parameters of resolve()
NameTypeDescription
$requestMilpa\Live\ValueObjects\DataSourceRequest