Skip to content

Added a note about the server_version DBAL option #5017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 14, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cookbook/doctrine/dbal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"
/>
</doctrine:config>
Expand All @@ -58,6 +61,8 @@ To get started, configure the database connection parameters:
'dbname' => 'Symfony',
'user' => 'root',
'password' => null,
'charset' => 'UTF8',
'server_version' => '5.6',
),
));

Expand Down
24 changes: 23 additions & 1 deletion reference/configuration/doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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%"
Expand Down Expand Up @@ -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: ~

Expand Down Expand Up @@ -202,6 +208,7 @@ Full Default Configuration
charset="UTF8"
logging="%kernel.debug%"
platform-service="MyOwnDatabasePlatformService"
server-version="5.6"
>
<doctrine:option key="foo">bar</doctrine:option>
<doctrine:mapping-type name="enum">string</doctrine:mapping-type>
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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">

<doctrine:option key="foo">bar</doctrine:option>
<doctrine:mapping-type name="enum">string</doctrine:mapping-type>
Expand All @@ -437,6 +446,17 @@ The following block shows all possible configuration keys:
</doctrine:config>
</container>

.. 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:

Expand All @@ -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
Expand Down