Skip to content

Commit

Permalink
feature #5017 Added a note about the server_version DBAL option (javi…
Browse files Browse the repository at this point in the history
…ereguiluz)

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
  • Loading branch information
weaverryan committed Mar 14, 2015
2 parents edd8618 + 470f713 commit 1dbed80
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
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

0 comments on commit 1dbed80

Please sign in to comment.