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 Feb 20, 2019
1 parent 2eb679f commit 044d878
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"require-dev": {
"nette/tester": "^2.0",
"nette/di": "^v3.0.0-beta2",
"nette/di": "^v3.0",
"mockery/mockery": "^1.0.0",
"tracy/tracy": "^2.4"
},
Expand Down
8 changes: 3 additions & 5 deletions src/Bridges/DatabaseDI/DatabaseExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ 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'])
->setExported();
->setAutowired($config['autowired']);

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

} else {
$conventions = Nette\DI\Config\Processor::filterArguments([$config['conventions']])[0];
$conventions = Nette\DI\Config\Processor::processArguments([$config['conventions']])[0];
}

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

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

0 comments on commit 044d878

Please sign in to comment.