From 19fca6fb8071a1cdcf909a6858d02bcd45b99916 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Wed, 24 Oct 2018 18:28:00 +0200 Subject: [PATCH] updated for nette/di 3 --- composer.json | 2 +- src/Bridges/DatabaseDI/DatabaseExtension.php | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 7d3f7e832..998cd0a7f 100644 --- a/composer.json +++ b/composer.json @@ -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" }, diff --git a/src/Bridges/DatabaseDI/DatabaseExtension.php b/src/Bridges/DatabaseDI/DatabaseExtension.php index 8e7266891..5b9edc175 100644 --- a/src/Bridges/DatabaseDI/DatabaseExtension.php +++ b/src/Bridges/DatabaseDI/DatabaseExtension.php @@ -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) @@ -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', [