Skip to content

Commit

Permalink
DatabaseExtension: added 'username' as alias for 'user'
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jan 9, 2025
1 parent 0690292 commit 1769a67
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Bridges/DatabaseDI/DatabaseExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function getConfigSchema(): Nette\Schema\Schema
Expect::structure([
'dsn' => Expect::string()->required()->dynamic(),
'user' => Expect::string()->nullable()->dynamic(),
'username' => Expect::string()->nullable()->dynamic(),
'password' => Expect::string()->nullable()->dynamic(),
'options' => Expect::array(),
'debugger' => Expect::bool(),
Expand Down Expand Up @@ -99,7 +100,7 @@ private function setupDatabase(\stdClass $config, string $name): void
$cache = new Statement(Nette\Caching\Cache::class, [1 => $cacheId]);

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

Expand Down

0 comments on commit 1769a67

Please sign in to comment.