getContainerBuilder(); $config = $this->getConfig(); $useProfiler = isset($config['profiler']) ? $config['profiler'] : !$container->parameters['productionMode']; 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::$bar->addPanel(?)', array('@self')) ->addSetup('Nette\Diagnostics\Debugger::$blueScreen->addPanel(?)', array(array('@self', 'renderException'))); $connection->addSetup('$service->onEvent[] = ?', array(array($panel, 'logEvent'))); } } }