Skip to content

Commit c7153ef

Browse files
committed
DatabaseExtension: detects Tracy by presence of service @tracy\BlueScreen [Closes nette/di#245]
1 parent b09b5ba commit c7153ef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Bridges/DatabaseDI/DatabaseExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function getConfigSchema(): Nette\Schema\Schema
3636
'user' => Expect::string()->nullable()->dynamic(),
3737
'password' => Expect::string()->nullable()->dynamic(),
3838
'options' => Expect::array(),
39-
'debugger' => Expect::bool(true),
39+
'debugger' => Expect::bool(),
4040
'explain' => Expect::bool(true),
4141
'reflection' => Expect::string(), // BC
4242
'conventions' => Expect::string('discovered'), // Nette\Database\Conventions\DiscoveredConventions
@@ -113,7 +113,7 @@ private function setupDatabase(\stdClass $config, string $name): void
113113
->setFactory(Nette\Database\Context::class, [$connection, $structure, $conventions])
114114
->setAutowired($config->autowired);
115115

116-
if ($config->debugger) {
116+
if ($config->debugger ?? $builder->getByType(\Tracy\BlueScreen::class)) {
117117
$connection->addSetup('@Tracy\BlueScreen::addPanel', [
118118
[Nette\Bridges\DatabaseTracy\ConnectionPanel::class, 'renderException'],
119119
]);

0 commit comments

Comments
 (0)