Skip to content

Commit

Permalink
Merge pull request doctrine#3572 from doctrine/loggerchain-constructor
Browse files Browse the repository at this point in the history
Make LoggerChain use constructor to add loggers instead of adder method
  • Loading branch information
morozov committed Jun 1, 2019
2 parents eb80fcb + 32803b9 commit 97b7305
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ The `Doctrine\DBAL\Driver\SQLSrv\SQLSrvStatement::LAST_INSERT_ID_SQL` constant

The constants in `Doctrine\DBAL\SQLParserUtils` have been deprecated and will be made private in 3.0.

## Deprecated `LoggerChain::addLogger` method

The `Doctrine\DBAL\Logging\LoggerChain::addLogger` method has been deprecated. Inject list of loggers via constructor instead.

# Upgrade to 2.9

## Deprecated `Statement::fetchColumn()` with an invalid index
Expand Down
10 changes: 10 additions & 0 deletions lib/Doctrine/DBAL/Logging/LoggerChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,19 @@ class LoggerChain implements SQLLogger
/** @var SQLLogger[] */
private $loggers = [];

/**
* @param SQLLogger[] $loggers
*/
public function __construct(array $loggers = [])
{
$this->loggers = $loggers;
}

/**
* Adds a logger in the chain.
*
* @deprecated Inject list of loggers via constructor instead
*
* @return void
*/
public function addLogger(SQLLogger $logger)
Expand Down

0 comments on commit 97b7305

Please sign in to comment.