Skip to content

DatabaseDefinitions

What the compiled databases configuration declares, as data.

The compiled form used to be statements required inside DatabaseManager::initialize(), assigning into $this->databases and $this->defaultDatabaseName from a scope it had no business reaching. It is a declaration now, for the same reasons the compiled factories configuration is — see FactoryDefinitions.

final readonly class DatabaseDefinitions

Since4.0.0
SourceDatabase/DatabaseDefinitions.php
PropertyTypeDescription
$databasesarrayreadonly.
$defaultstringreadonly.

public function __construct(array<string, array{class: class-string<Database>, parameters: array<string, mixed>}> $databases, string $default): mixed

The connection answered when none is named.

ParameterTypeDescription
$databasesarray``<``string``, ``array{class: class-string<Database>, parameters: array<string, mixed>}``>Keyed by connection name, in declaration order.
$defaultstringThe connection answered when none is named.

Returns mixed

MethodDescription
fromCompiled(mixed $compiled, string $source = 'the compiled databases cache'): DatabaseDefinitionsRead a compiled declaration, rejecting anything malformed.

public static function fromCompiled(mixed $compiled, string $source = 'the compiled databases cache'): DatabaseDefinitions

Read a compiled declaration, rejecting anything malformed.

Whatever the compiled file returned.

ParameterTypeDescription
$compiledmixedWhatever the compiled file returned.
$sourcestring

Returns DatabaseDefinitions

ThrowsWhen
ConfigurationExceptionWhen $compiled is not a declaration this version understands — most likely a cache compiled by an earlier one.