Skip to content

Commit 1769a67

Browse files
committed
DatabaseExtension: added 'username' as alias for 'user'
1 parent 0690292 commit 1769a67

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Bridges/DatabaseDI/DatabaseExtension.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function getConfigSchema(): Nette\Schema\Schema
3535
Expect::structure([
3636
'dsn' => Expect::string()->required()->dynamic(),
3737
'user' => Expect::string()->nullable()->dynamic(),
38+
'username' => Expect::string()->nullable()->dynamic(),
3839
'password' => Expect::string()->nullable()->dynamic(),
3940
'options' => Expect::array(),
4041
'debugger' => Expect::bool(),
@@ -99,7 +100,7 @@ private function setupDatabase(\stdClass $config, string $name): void
99100
$cache = new Statement(Nette\Caching\Cache::class, [1 => $cacheId]);
100101

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

0 commit comments

Comments
 (0)