DDC-560: Fix DBAL PostConnect code example in docs #694

Closed
opened 2026-01-22 12:46:59 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Apr 30, 2010).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user mjh_ca:

Two small corrections to http://www.doctrine-project.org/documentation/manual/2_0/en/dbal:configuration:dbal-events#postconnect-event

  • There should be a semi-colon after new EventManager() instead of a comma
    * The parameter to the MysqlSessionInit constructor should be UTF8 and not UTF-8. The parameter with the dash causes a PDOException:
  SQLSTATE[42000]: Syntax error or access violation: 1115 Unknown character set: 'UTF'

Corrected code:

<?php

$evm = new EventManager();
$evm->addEventSubscriber(new MysqlSessionInit('UTF8'));

$conn = DriverManager::getConnection($connectionParams, null, $evm);
Originally created by @doctrinebot on GitHub (Apr 30, 2010). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user mjh_ca: Two small corrections to http://www.doctrine-project.org/documentation/manual/2_0/en/dbal:configuration:dbal-events#postconnect-event - There should be a semi-colon after new EventManager() instead of a comma *\* The parameter to the MysqlSessionInit constructor should be _UTF8_ and not _UTF-8_*. The parameter with the dash causes a PDOException: ``` SQLSTATE[42000]: Syntax error or access violation: 1115 Unknown character set: 'UTF' ``` Corrected code: ``` <?php $evm = new EventManager(); $evm->addEventSubscriber(new MysqlSessionInit('UTF8')); $conn = DriverManager::getConnection($connectionParams, null, $evm); ```
admin added the Bug label 2026-01-22 12:46:59 +01:00
admin closed this issue 2026-01-22 12:47:01 +01:00
Author
Owner

@doctrinebot commented on GitHub (Apr 30, 2010):

Comment created by @beberlei:

Fixed

@doctrinebot commented on GitHub (Apr 30, 2010): Comment created by @beberlei: Fixed
Author
Owner

@doctrinebot commented on GitHub (Apr 30, 2010):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Apr 30, 2010): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#694