Skip to content

Commit

Permalink
Fix after review
Browse files Browse the repository at this point in the history
  • Loading branch information
ottaviano committed May 1, 2019
1 parent e304f01 commit 364d693
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Dbal/Logging/BacktraceLogger.php
Expand Up @@ -4,12 +4,12 @@

use Doctrine\DBAL\Logging\DebugStack;

class BacktraceLogger extends DebugStack
final class BacktraceLogger extends DebugStack
{
/**
* {@inheritdoc}
*/
public function startQuery($sql, ?array $params = null, ?array $types = null)
public function startQuery($sql, ?array $params = null, ?array $types = null) : void
{
parent::startQuery($sql, $params, $types);

Expand Down
5 changes: 4 additions & 1 deletion DependencyInjection/Configuration.php
Expand Up @@ -143,7 +143,10 @@ private function getDbalConnectionsNode()
->scalarNode('schema_filter')->end()
->booleanNode('logging')->defaultValue($this->debug)->end()
->booleanNode('profiling')->defaultValue($this->debug)->end()
->booleanNode('profiling_backtrace')->defaultValue(false)->end()
->booleanNode('profiling_backtrace')
->defaultValue(false)
->info('To enable Query backtrace record')
->end()
->scalarNode('server_version')->end()
->scalarNode('driver_class')->end()
->scalarNode('wrapper_class')->end()
Expand Down
8 changes: 3 additions & 5 deletions DependencyInjection/DoctrineExtension.php
Expand Up @@ -134,11 +134,9 @@ protected function loadDbalConnection($name, array $connection, ContainerBuilder
unset($connection['logging']);

if ($connection['profiling'] || $connection['profiling_backtrace']) {
if ($connection['profiling_backtrace']) {
$profilingAbstractId = 'doctrine.dbal.logger.backtrace';
} else {
$profilingAbstractId = 'doctrine.dbal.logger.profiling';
}
$profilingAbstractId = $connection['profiling_backtrace'] ?
'doctrine.dbal.logger.backtrace' :
'doctrine.dbal.logger.profiling';

$profilingLoggerId = $profilingAbstractId . '.' . $name;
$container->setDefinition($profilingLoggerId, new ChildDefinition($profilingAbstractId));
Expand Down
2 changes: 1 addition & 1 deletion Tests/Dbal/Logging/BacktraceLoggerTest.php
Expand Up @@ -7,7 +7,7 @@

class BacktraceLoggerTest extends TestCase
{
public function testBacktraceLogged()
public function testBacktraceLogged() : void
{
$logger = new BacktraceLogger();
$logger->startQuery('SELECT column FROM table');
Expand Down

0 comments on commit 364d693

Please sign in to comment.