Skip to content

Commit

Permalink
Extension: Fix DIC support.
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek authored Oct 19, 2021
1 parent 49f28b3 commit 7f40b03
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/DatabaseExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Logging\LoggerChain;
use Doctrine\DBAL\Portability\Connection as PortabilityConnection;
use Doctrine\DBAL\Tools\Console\ConnectionProvider\SingleConnectionProvider;
use Nette\DI\CompilerExtension;
use Nette\DI\ContainerBuilder;
use Nette\DI\Definitions\ServiceDefinition;
Expand Down Expand Up @@ -322,7 +323,9 @@ private function loadDoctrineConfiguration(): void
if ($config['configuration']['sqlLogger'] !== null) { // SqlLogger (append to chain)
$loggers[] = '@' . $config['configuration']['sqlLogger'];
}
$loggers[] = $builder->getDefinition('doctrine.queryPanel');
if ($builder->hasDefinition('doctrine.queryPanel')) {
$loggers[] = $builder->getDefinition('doctrine.queryPanel');
}
$logger->setArgument('loggers', $loggers);

if ($config['configuration']['resultCacheImpl'] !== null) { // ResultCacheImpl
Expand Down Expand Up @@ -446,6 +449,9 @@ private function loadConnectionConfiguration(): void
$builder->getDefinitionByType(EventManager::class),
]
);

$builder->addDefinition($this->prefix('singleConnectionProvider'))
->setFactory(SingleConnectionProvider::class);
}


Expand Down

0 comments on commit 7f40b03

Please sign in to comment.