Skip to content

Commit 32803b9

Browse files
committed
Make LoggerChain use constructor to add loggers instead of adder method
1 parent a2450fb commit 32803b9

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

UPGRADE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ The `Doctrine\DBAL\Driver\SQLSrv\SQLSrvStatement::LAST_INSERT_ID_SQL` constant
4242

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

45+
## Deprecated `LoggerChain::addLogger` method
46+
47+
The `Doctrine\DBAL\Logging\LoggerChain::addLogger` method has been deprecated. Inject list of loggers via constructor instead.
48+
4549
# Upgrade to 2.9
4650

4751
## Deprecated `Statement::fetchColumn()` with an invalid index

lib/Doctrine/DBAL/Logging/LoggerChain.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,19 @@ class LoggerChain implements SQLLogger
1010
/** @var SQLLogger[] */
1111
private $loggers = [];
1212

13+
/**
14+
* @param SQLLogger[] $loggers
15+
*/
16+
public function __construct(array $loggers = [])
17+
{
18+
$this->loggers = $loggers;
19+
}
20+
1321
/**
1422
* Adds a logger in the chain.
1523
*
24+
* @deprecated Inject list of loggers via constructor instead
25+
*
1626
* @return void
1727
*/
1828
public function addLogger(SQLLogger $logger)

0 commit comments

Comments
 (0)