Final Class Yiisoft\Db\Migration\DatabaseSetRegistry
| Inheritance | Yiisoft\ |
|---|
Additional named database sets, in execution order. The "default" database is always configured by the existing command dependencies, so it can't be defined here.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| getNames() | Yiisoft\ |
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| DEFAULT_DATABASE | 'default' | Name of the default database configured by the existing command dependencies. | Yiisoft\ |
Method Details
| public mixed __construct ( \ | ||
| $injector | \ |
|
| $informer | Yiisoft\ |
|
| $databases | array |
Additional named sets, excluding "default". |
public function __construct(
private readonly Injector $injector,
private readonly MigrationInformerInterface $informer,
array $databases = [],
) {
$sets = [];
foreach ($databases as $name => $database) {
if (!is_string($name) || trim($name) === '') {
throw new InvalidArgumentException('Database names must be non-empty strings.');
}
if ($name === self::DEFAULT_DATABASE) {
throw new InvalidArgumentException(
'The "' . self::DEFAULT_DATABASE
. '" database is configured by the existing migration settings and can\'t be redefined.',
);
}
$sets[$name] = $database;
}
$this->databases = $sets;
}
| public list |
public function getNames(): array
{
return array_keys([self::DEFAULT_DATABASE => null, ...$this->databases]);
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.