Skip to content

Commit

Permalink
Deprecate SQLLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed Nov 21, 2021
1 parent 85496f7 commit 24f43ac
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
5 changes: 5 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ awareness about deprecated code.

# Upgrade to 3.2

## Deprecated `SQLLogger` and its implementations.

The `SQLLogger` and its implementations `DebugStack` and `LoggerChain` have been deprecated.
For logging purposes, use `Doctrine\DBAL\Logging\Middleware` instead. No replacement for `DebugStack` is provided.

## Deprecated `SqliteSchemaManager::createDatabase()` and `dropDatabase()` methods.

The `SqliteSchemaManager::createDatabase()` and `dropDatabase()` methods have been deprecated. The SQLite engine
Expand Down
12 changes: 12 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@
TODO: remove in 4.0.0
-->
<referencedClass name="Doctrine\DBAL\Schema\Constraint"/>
<!--
TODO: remove in 4.0.0
See https://github.com/doctrine/dbal/pull/4967
-->
<referencedClass name="Doctrine\DBAL\Logging\DebugStack"/>
<referencedClass name="Doctrine\DBAL\Logging\SQLLogger"/>
<referencedClass name="Doctrine\DBAL\Logging\LoggerChain"/>
</errorLevel>
</DeprecatedClass>
<DeprecatedInterface>
Expand All @@ -80,6 +87,11 @@
TODO: remove in 4.0.0
-->
<referencedClass name="Doctrine\DBAL\Schema\Constraint"/>
<!--
TODO: remove in 4.0.0
See https://github.com/doctrine/dbal/pull/4967
-->
<referencedClass name="Doctrine\DBAL\Logging\SQLLogger"/>
</errorLevel>
</DeprecatedInterface>
<DeprecatedMethod>
Expand Down
13 changes: 13 additions & 0 deletions src/Logging/DebugStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

namespace Doctrine\DBAL\Logging;

use Doctrine\Deprecations\Deprecation;

use function microtime;

/**
* Includes executed SQLs in a Debug Stack.
*
* @deprecated
*/
class DebugStack implements SQLLogger
{
Expand All @@ -29,6 +33,15 @@ class DebugStack implements SQLLogger
/** @var int */
public $currentQuery = 0;

public function __construct()
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/4967',
'DebugStack is deprecated.'
);
}

/**
* {@inheritdoc}
*/
Expand Down
10 changes: 10 additions & 0 deletions src/Logging/LoggerChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

namespace Doctrine\DBAL\Logging;

use Doctrine\Deprecations\Deprecation;

/**
* Chains multiple SQLLogger.
*
* @deprecated
*/
class LoggerChain implements SQLLogger
{
Expand All @@ -15,6 +19,12 @@ class LoggerChain implements SQLLogger
*/
public function __construct(iterable $loggers = [])
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/4967',
'LoggerChain is deprecated'
);

$this->loggers = $loggers;
}

Expand Down
3 changes: 3 additions & 0 deletions src/Logging/SQLLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

/**
* Interface for SQL loggers.
*
* @deprecated Use {@link \Doctrine\DBAL\Logging\Middleware} or implement
* {@link \Doctrine\DBAL\Driver\Middleware} instead.
*/
interface SQLLogger
{
Expand Down

0 comments on commit 24f43ac

Please sign in to comment.