Resolver

 class Winter\Storm\Halcyon\Datasource\Resolver
implements 
    Winter\Storm\Halcyon\Datasource\ResolverInterface

Properties

protected $datasources : array

All of the registered datasources.

protected $default : string | null

The default datasource name.

Methods

public __construct (array $datasources = [])

Create a new datasource resolver instance.

Parameters
Property Description
$datasources
array
Returns
mixed

public addDatasource (string $name, Winter\Storm\Halcyon\Datasource\DatasourceInterface $datasource) : void

Adds a datasource to the resolver.

Parameters
Property Description
$name
string
$datasource
Winter\Storm\Halcyon\Datasource\DatasourceInterface
Returns
void

public datasource ($name = null) : Winter\Storm\Halcyon\Datasource\DatasourceInterface

Get a datasource instance by name.

Parameters
Property Description
$name
mixed
Returns
Winter\Storm\Halcyon\Datasource\DatasourceInterface

public getDefaultDatasource () : string | null

Gets the default datasource name.

Returns
string | null

public hasDatasource (string $name) : bool

Returns if the given datasource name exists.

Parameters
Property Description
$name
string
Returns
bool

public setDefaultDatasource (string $name) : void

Sets the default datasource name.

Parameters
Property Description
$name
string
Returns
void
Copyright © 2024 Winter CMS