guilhermeblanco/zendframework1-doctrine2 — pull request #52 by Future500 (2013-02-28 22:50:17+00:00)
Title: Added support for parameters to sqlLoggerClass

The config setting dbal.connections.app.sqlLoggerClass allows for a sql logger, but the class is contructed without parameters.

This change adds support for (optional) parameters to be sent to the sqlLoggerClass constructor, by setting an additional sqlLoggerParams key.

Use case: I have sqlLogger class that implements Doctrine\DBAL\Logging\SQLLogger and uses a Zend_Log instance to write queries to a logfile. The constuctor looks like this:

public function __construct( $params ) {
$this->_log = Zend_Log::factory( $params );
}

And can now be set from the config file by:

dbal.connections.app:
.sqlLoggerClass = "F500_Log_DoctrineSQLLogger"
.sqlLoggerParams.writer.writerName = "Stream"
.sqlLoggerParams.writer.writerParams.stream = APPLICATION_PATH "/../temp/logs/app.doctrine.log"
.sqlLoggerParams.writer.formatterName = "Simple"
sqlLoggerParams.writer.formatterParams.format = "SQL STATEMENT: %message%" PHP_EOL Params: "%params%" PHP_EOL Types: "%types%" PHP_EOL PHP_EOL