Permalink
Browse files

[DoctrineBridge][DoctrineBundle] Refactored the DBAL logging

This allows enabling the logging and the profiling separately for instance
when doing batch processing leading to memory issue due to the profiling.
  • Loading branch information...
1 parent b6f7919 commit d6344b3e261784706cd82dc32721b4f2810aaf65 @stof stof committed Dec 15, 2011
Showing with 4 additions and 8 deletions.
  1. +2 −2 DataCollector/DoctrineDataCollector.php
  2. +2 −6 Logger/DbalLogger.php
@@ -12,10 +12,10 @@
namespace Symfony\Bridge\Doctrine\DataCollector;
use Doctrine\Common\Persistence\ManagerRegistry;
+use Doctrine\DBAL\Logging\DebugStack;
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
-use Symfony\Bridge\Doctrine\Logger\DbalLogger;
/**
* DoctrineDataCollector.
@@ -28,7 +28,7 @@ class DoctrineDataCollector extends DataCollector
private $managers;
private $logger;
- public function __construct(ManagerRegistry $registry, DbalLogger $logger = null)
+ public function __construct(ManagerRegistry $registry, DebugStack $logger = null)
{
$this->connections = $registry->getConnectionNames();
$this->managers = $registry->getManagerNames();
View
@@ -13,14 +13,14 @@
use Symfony\Component\HttpKernel\Log\LoggerInterface;
use Symfony\Component\HttpKernel\Debug\Stopwatch;
-use Doctrine\DBAL\Logging\DebugStack;
+use Doctrine\DBAL\Logging\SQLLogger;
/**
* DbalLogger.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
-class DbalLogger extends DebugStack
+class DbalLogger implements SQLLogger
{
protected $logger;
protected $stopwatch;
@@ -42,8 +42,6 @@ public function __construct(LoggerInterface $logger = null, Stopwatch $stopwatch
*/
public function startQuery($sql, array $params = null, array $types = null)
{
- parent::startQuery($sql, $params, $types);
-
if (null !== $this->stopwatch) {
$this->stopwatch->start('doctrine', 'doctrine');
}
@@ -58,8 +56,6 @@ public function startQuery($sql, array $params = null, array $types = null)
*/
public function stopQuery()
{
- parent::stopQuery();
-
if (null !== $this->stopwatch) {
$this->stopwatch->stop('doctrine');
}

0 comments on commit d6344b3

Please sign in to comment.