Skip to content

Commit 1dbed80

Browse files
committed
feature #5017 Added a note about the server_version DBAL option (javiereguiluz)
This PR was merged into the 2.3 branch. Discussion ---------- Added a note about the server_version DBAL option | Q | A | ------------- | --- | Doc fix? | no | New docs? | yes | Applies to | 2.3+ | Fixed tickets | #4597 Some comments: * This is probably a temporary fix because DoctrineBundle will hopefully fix this problem soon * DBAL options are not explained, so I added this explanation as a `note` * If you agree with this, please merge this PR soon because people are having problems with this new option Commits ------- 470f713 Added a note about the server_version DBAL option
2 parents edd8618 + 470f713 commit 1dbed80

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

cookbook/doctrine/dbal.rst

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ To get started, configure the database connection parameters:
3535
user: root
3636
password: null
3737
charset: UTF8
38+
server_version: 5.6
3839
3940
.. code-block:: xml
4041
@@ -45,6 +46,8 @@ To get started, configure the database connection parameters:
4546
dbname="Symfony"
4647
user="root"
4748
password="null"
49+
charset="UTF8"
50+
server-version="5.6"
4851
driver="pdo_mysql"
4952
/>
5053
</doctrine:config>
@@ -58,6 +61,8 @@ To get started, configure the database connection parameters:
5861
'dbname' => 'Symfony',
5962
'user' => 'root',
6063
'password' => null,
64+
'charset' => 'UTF8',
65+
'server_version' => '5.6',
6166
),
6267
));
6368

reference/configuration/doctrine.rst

+23-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ Full Default Configuration
6060
driver: pdo_mysql
6161
platform_service: ~
6262
63+
# the version of your database engine
64+
server_version: ~
65+
6366
# when true, queries are logged to a "doctrine" monolog channel
6467
logging: "%kernel.debug%"
6568
profiling: "%kernel.debug%"
@@ -102,6 +105,9 @@ Full Default Configuration
102105
# True to use a pooled server with the oci8 driver
103106
pooled: ~
104107
108+
# the version of your database engine
109+
server_version: ~
110+
105111
# Configuring MultipleActiveResultSets for the pdo_sqlsrv driver
106112
MultipleActiveResultSets: ~
107113
@@ -202,6 +208,7 @@ Full Default Configuration
202208
charset="UTF8"
203209
logging="%kernel.debug%"
204210
platform-service="MyOwnDatabasePlatformService"
211+
server-version="5.6"
205212
>
206213
<doctrine:option key="foo">bar</doctrine:option>
207214
<doctrine:mapping-type name="enum">string</doctrine:mapping-type>
@@ -393,6 +400,7 @@ The following block shows all possible configuration keys:
393400
charset: UTF8
394401
logging: "%kernel.debug%"
395402
platform_service: MyOwnDatabasePlatformService
403+
server_version: 5.6
396404
mapping_types:
397405
enum: string
398406
types:
@@ -428,7 +436,8 @@ The following block shows all possible configuration keys:
428436
wrapper-class="MyDoctrineDbalConnectionWrapper"
429437
charset="UTF8"
430438
logging="%kernel.debug%"
431-
platform-service="MyOwnDatabasePlatformService">
439+
platform-service="MyOwnDatabasePlatformService"
440+
server-version="5.6">
432441
433442
<doctrine:option key="foo">bar</doctrine:option>
434443
<doctrine:mapping-type name="enum">string</doctrine:mapping-type>
@@ -437,6 +446,17 @@ The following block shows all possible configuration keys:
437446
</doctrine:config>
438447
</container>
439448
449+
.. note::
450+
451+
The ``server_version`` option was added in Doctrine DBAL 2.5, which is used
452+
by DoctrineBundle 1.3 version. The value of this option should match your
453+
database server version (use ``postgres -V`` or ``psql -V`` command to find
454+
your PostgreSQL version and ``mysql -V`` to get your MySQL version).
455+
456+
If you don't define this option and you don't have created your database yet,
457+
you may get ``PDOException`` errors because Doctrine will try to guess the
458+
database server version automatically and none is available.
459+
440460
If you want to configure multiple connections in YAML, put them under the
441461
``connections`` key and give them a unique name:
442462

@@ -451,11 +471,13 @@ If you want to configure multiple connections in YAML, put them under the
451471
user: root
452472
password: null
453473
host: localhost
474+
server_version: 5.6
454475
customer:
455476
dbname: customer
456477
user: root
457478
password: null
458479
host: localhost
480+
server_version: 5.7
459481
460482
The ``database_connection`` service always refers to the *default* connection,
461483
which is the first one defined or the one configured via the

0 commit comments

Comments
 (0)