From 470f7130ab4aae5fed193b517aab55d7094a868a Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 19 Feb 2015 11:15:13 +0100 Subject: [PATCH] Added a note about the server_version DBAL option --- cookbook/doctrine/dbal.rst | 5 +++++ reference/configuration/doctrine.rst | 24 +++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/cookbook/doctrine/dbal.rst b/cookbook/doctrine/dbal.rst index 39cb0eabeaf..006c99371ef 100644 --- a/cookbook/doctrine/dbal.rst +++ b/cookbook/doctrine/dbal.rst @@ -35,6 +35,7 @@ To get started, configure the database connection parameters: user: root password: null charset: UTF8 + server_version: 5.6 .. code-block:: xml @@ -45,6 +46,8 @@ To get started, configure the database connection parameters: dbname="Symfony" user="root" password="null" + charset="UTF8" + server-version="5.6" driver="pdo_mysql" /> @@ -58,6 +61,8 @@ To get started, configure the database connection parameters: 'dbname' => 'Symfony', 'user' => 'root', 'password' => null, + 'charset' => 'UTF8', + 'server_version' => '5.6', ), )); diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index d11044e632a..0ca3c03cf64 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -60,6 +60,9 @@ Full Default Configuration driver: pdo_mysql platform_service: ~ + # the version of your database engine + server_version: ~ + # when true, queries are logged to a "doctrine" monolog channel logging: "%kernel.debug%" profiling: "%kernel.debug%" @@ -102,6 +105,9 @@ Full Default Configuration # True to use a pooled server with the oci8 driver pooled: ~ + # the version of your database engine + server_version: ~ + # Configuring MultipleActiveResultSets for the pdo_sqlsrv driver MultipleActiveResultSets: ~ @@ -202,6 +208,7 @@ Full Default Configuration charset="UTF8" logging="%kernel.debug%" platform-service="MyOwnDatabasePlatformService" + server-version="5.6" > bar string @@ -393,6 +400,7 @@ The following block shows all possible configuration keys: charset: UTF8 logging: "%kernel.debug%" platform_service: MyOwnDatabasePlatformService + server_version: 5.6 mapping_types: enum: string types: @@ -428,7 +436,8 @@ The following block shows all possible configuration keys: wrapper-class="MyDoctrineDbalConnectionWrapper" charset="UTF8" logging="%kernel.debug%" - platform-service="MyOwnDatabasePlatformService"> + platform-service="MyOwnDatabasePlatformService" + server-version="5.6"> bar string @@ -437,6 +446,17 @@ The following block shows all possible configuration keys: +.. note:: + + The ``server_version`` option was added in Doctrine DBAL 2.5, which is used + by DoctrineBundle 1.3 version. The value of this option should match your + database server version (use ``postgres -V`` or ``psql -V`` command to find + your PostgreSQL version and ``mysql -V`` to get your MySQL version). + + If you don't define this option and you don't have created your database yet, + you may get ``PDOException`` errors because Doctrine will try to guess the + database server version automatically and none is available. + If you want to configure multiple connections in YAML, put them under the ``connections`` key and give them a unique name: @@ -451,11 +471,13 @@ If you want to configure multiple connections in YAML, put them under the user: root password: null host: localhost + server_version: 5.6 customer: dbname: customer user: root password: null host: localhost + server_version: 5.7 The ``database_connection`` service always refers to the *default* connection, which is the first one defined or the one configured via the