Make LoggerChain use constructor to add loggers instead of adder method

parent a2450fb0
...@@ -42,6 +42,10 @@ The `Doctrine\DBAL\Driver\SQLSrv\SQLSrvStatement::LAST_INSERT_ID_SQL` constant ...@@ -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. 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 # Upgrade to 2.9
## Deprecated `Statement::fetchColumn()` with an invalid index ## Deprecated `Statement::fetchColumn()` with an invalid index
......
...@@ -10,9 +10,19 @@ class LoggerChain implements SQLLogger ...@@ -10,9 +10,19 @@ class LoggerChain implements SQLLogger
/** @var SQLLogger[] */ /** @var SQLLogger[] */
private $loggers = []; private $loggers = [];
/**
* @param SQLLogger[] $loggers
*/
public function __construct(array $loggers = [])
{
$this->loggers = $loggers;
}
/** /**
* Adds a logger in the chain. * Adds a logger in the chain.
* *
* @deprecated Inject list of loggers via constructor instead
*
* @return void * @return void
*/ */
public function addLogger(SQLLogger $logger) public function addLogger(SQLLogger $logger)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment