Commit 5bb44d96 authored by Jonathan H. Wage's avatar Jonathan H. Wage

Fixing events.

parent 986d8f1c
......@@ -92,28 +92,4 @@ in the `platform` option.
+++ Custom Driver Options
The `driverOptions` option allows to pass arbitrary options through to the driver.
This is equivalent to the 4th argument of the [PDO constructor](http://php.net/manual/en/pdo.construct.php).
+++ Events
++++ PostConnect Event
`Doctrine\DBAL\Events::postConnect` is triggered right after the connection to
the database is established. It allows to specify any relevant connection
specific options and gives access to the `Doctrine\DBAL\Connection` instance
that is responsible for the connection management via an instance of
`Doctrine\DBAL\Event\ConnectionEventArgs` event arguments instance.
Doctrine is already shipped with two implementations for the "PostConnect" event:
* `Doctrine\DBAL\Event\Listeners\OracleSessionInit` allows to specify any number of Oracle Session related enviroment variables that are set right after the connection is established.
* `Doctrine\DBAL\Event\Listeners\MysqlSessionInit` allows to specify the Charset and Collation of the Client Connection if these options are not configured correctly on the MySQL server side.
You can register events by subscribing them to the `EventManager` instance
passed to the Connection factory:
[php]
$evm = new EventManager();
$evm->addEventSubscriber(new MysqlSessionInit('UTF8'));
$conn = DriverManager::getConnection($connectionParams, null, $evm);
\ No newline at end of file
This is equivalent to the 4th argument of the [PDO constructor](http://php.net/manual/en/pdo.construct.php).
\ No newline at end of file
......@@ -19,7 +19,7 @@ You can register events by subscribing them to the `EventManager` instance
passed to the Connection factory:
[php]
$evm = new EventManager(),
$evm->addEventSubscriber(new MysqlSessionInit('UTF-8'));
$evm = new EventManager();
$evm->addEventSubscriber(new MysqlSessionInit('UTF8'));
$conn = DriverManager::getConnection($connectionParams, null, $evm);
\ No newline at end of file
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