getContainerBuilder(); $config = $this->getConfig(); $useProfiler = isset($config['profiler']) ? $config['profiler'] : $container->parameters['debugMode']; unset($config['profiler']); if (isset($config['flags'])) { $flags = 0; foreach ((array) $config['flags'] as $flag) { $flags |= constant($flag); } $config['flags'] = $flags; } $connection = $container->addDefinition($this->prefix('connection')) ->setClass('DibiConnection', array($config)); if ($useProfiler) { $panel = $container->addDefinition($this->prefix('panel')) ->setClass('DibiNettePanel') ->addSetup('Nette\Diagnostics\Debugger::getBar()->addPanel(?)', array('@self')) ->addSetup('Nette\Diagnostics\Debugger::getBlueScreen()->addPanel(?)', array('DibiNettePanel::renderException')); $connection->addSetup('$service->onEvent[] = ?', array(array($panel, 'logEvent'))); } } }