Skip to content

Commit

Permalink
updated for nette/di 3
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Nov 5, 2018
1 parent 2e1a97b commit 4ec945e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Bridges/DatabaseDI/DatabaseExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ private function setupDatabase(array $config, string $name): void

$connection = $builder->addDefinition($this->prefix("$name.connection"))
->setFactory(Nette\Database\Connection::class, [$config['dsn'], $config['user'], $config['password'], $config['options']])
->setAutowired($config['autowired']);
->setAutowired($config['autowired'])
->setPublic();

$structure = $builder->addDefinition($this->prefix("$name.structure"))
->setFactory(Nette\Database\Structure::class)
Expand Down Expand Up @@ -107,13 +108,13 @@ private function setupDatabase(array $config, string $name): void
->setAutowired($config['autowired']);

} else {
$class = method_exists(Nette\DI\Helpers::class, 'filterArguments') ? Nette\DI\Helpers::class : Nette\DI\Compiler::class;
$conventions = $class::filterArguments([$config['conventions']])[0];
$conventions = Nette\DI\Config\Processor::filterArguments([$config['conventions']])[0];
}

$builder->addDefinition($this->prefix("$name.context"))
->setFactory(Nette\Database\Context::class, [$connection, $structure, $conventions])
->setAutowired($config['autowired']);
->setAutowired($config['autowired'])
->setPublic();

if ($config['debugger']) {
$connection->addSetup('@Tracy\BlueScreen::addPanel', [
Expand Down

0 comments on commit 4ec945e

Please sign in to comment.