Skip to content

Commit 3a62e82

Browse files
committed
DatabaseExtension: added 'username' as alias for 'user'
1 parent e1eb620 commit 3a62e82

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/Bridges/DatabaseDI/DatabaseExtension.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function getConfigSchema(): Nette\Schema\Schema
3333
Expect::structure([
3434
'dsn' => Expect::string()->required()->dynamic(),
3535
'user' => Expect::string()->nullable()->dynamic(),
36+
'username' => Expect::string()->nullable()->dynamic(),
3637
'password' => Expect::string()->nullable()->dynamic(),
3738
'options' => Expect::array(),
3839
'debugger' => Expect::bool(),
@@ -97,7 +98,7 @@ private function setupDatabase(\stdClass $config, string $name): void
9798
$cache = new Statement(Nette\Caching\Cache::class, [1 => $cacheId]);
9899

99100
$explorer = $builder->addDefinition($this->prefix($name))
100-
->setFactory(Nette\Database\Explorer::class, [$config->dsn, $config->user, $config->password, $config->options])
101+
->setFactory(Nette\Database\Explorer::class, [$config->dsn, $config->username ?? $config->user, $config->password, $config->options])
101102
->addSetup('setCache', [$cache])
102103
->setAutowired($config->autowired);
103104

0 commit comments

Comments
 (0)