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 23, 2018
1 parent 79c0ea6 commit 19fca6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 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": "^2.4 || ~3.0.0",
"nette/di": "^v3.0.0-beta2",
"mockery/mockery": "^1.0.0",
"tracy/tracy": "^2.4"
},
Expand Down
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'])
->setExported();

$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'])
->setExported();

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

0 comments on commit 19fca6f

Please sign in to comment.