Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make LoggerChain use constructor to add loggers instead of adder method #3572

Merged
merged 1 commit into from
Jun 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
ostrolucky marked this conversation as resolved.
Show resolved Hide resolved
*/
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