Skip to content
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

Add missing default_dbname configuration option #835

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions DependencyInjection/Configuration.php
Expand Up @@ -214,6 +214,11 @@ private function configureDbalDriverNode(ArrayNodeDefinition $node)
->scalarNode('server')
->info('The name of a running database server to connect to for SQL Anywhere.')
->end()
->scalarNode('default_dbname')
->info(
'Override the default database (postgres) to connect to for PostgreSQL connexion.'
)
->end()
->scalarNode('sslmode')
->info(
'Determines whether or with what priority a SSL TCP/IP connection will be negotiated with ' .
Expand Down
1 change: 1 addition & 0 deletions Resources/config/schema/doctrine-1.0.xsd
Expand Up @@ -59,6 +59,7 @@
<xsd:attribute name="service" type="xsd:string" />
<xsd:attribute name="servicename" type="xsd:string" />
<xsd:attribute name="session-mode" type="xsd:string" />
<xsd:attribute name="default_dbname" type="xsd:string" />
<xsd:attribute name="sslmode" type="xsd:string" />
<xsd:attribute name="sslrootcert" type="xsd:string" />
<xsd:attribute name="pooled" type="xsd:string" />
Expand Down
22 changes: 21 additions & 1 deletion Resources/doc/configuration.rst
Expand Up @@ -58,6 +58,10 @@ Configuration Reference
# SQL Anywhere specific (ServerName). The name of a running database server to connect to for SQL Anywhere.
server: ~

# PostgreSQL specific (default_dbname).
# Override the default database (postgres) to connect to.
default_dbname: ~

# PostgreSQL specific (LIBPQ-CONNECT-SSLMODE).
# Determines whether or with what priority a SSL TCP/IP connection will be negotiated with the server for PostgreSQL.
sslmode: ~
Expand Down Expand Up @@ -90,7 +94,7 @@ Configuration Reference
profiling: "%kernel.debug%"
server_version: ~
driver_class: ~
# Allows to specify a custom wrapper implementation to use.
# Allows to specify a custom wrapper implementation to use.
# Must be a subclass of Doctrine\DBAL\Connection
wrapper_class: ~
shard_choser: ~
Expand Down Expand Up @@ -148,6 +152,10 @@ Configuration Reference
# SQL Anywhere specific (ServerName). The name of a running database server to connect to for SQL Anywhere.
server: ~

# PostgreSQL specific (default_dbname).
# Override the default database (postgres) to connect to.
default_dbname: ~

# PostgreSQL specific (LIBPQ-CONNECT-SSLMODE).
# Determines whether or with what priority a SSL TCP/IP connection will be negotiated with the server for PostgreSQL.
sslmode: ~
Expand Down Expand Up @@ -196,6 +204,10 @@ Configuration Reference
# SQL Anywhere specific (ServerName). The name of a running database server to connect to for SQL Anywhere.
server: ~

# PostgreSQL specific (default_dbname).
# Override the default database (postgres) to connect to.
default_dbname: ~

# PostgreSQL specific (LIBPQ-CONNECT-SSLMODE).
# Determines whether or with what priority a SSL TCP/IP connection will be negotiated with the server for PostgreSQL.
sslmode: ~
Expand Down Expand Up @@ -399,6 +411,7 @@ Configuration Reference
<!-- servicename: Overrules dbname parameter if given and used as SERVICE_NAME or SID connection parameter for Oracle depending on the service parameter. -->
<!-- sessionMode: The session mode to use for the oci8 driver -->
<!-- server: The name of a running database server to connect to for SQL Anywhere. -->
<!-- default_dbname: Override the default database (postgres) to connect to for PostgreSQL. -->
<!-- sslmode: Determines whether or with what priority a SSL TCP/IP connection will be negotiated with the server for PostgreSQL. -->
<!-- sslrootcert: The name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. -->
<!-- pooled: True to use a pooled server with the oci8/pdo_oracle driver -->
Expand All @@ -421,6 +434,7 @@ Configuration Reference
servicename=""
sessionMode=""
server=""
default_dbname=""
sslmode=""
sslrootcert=""
pooled=""
Expand Down Expand Up @@ -459,6 +473,7 @@ Configuration Reference
<!-- servicename: Overrules dbname parameter if given and used as SERVICE_NAME or SID connection parameter for Oracle depending on the service parameter. -->
<!-- sessionMode: The session mode to use for the oci8 driver -->
<!-- server: The name of a running database server to connect to for SQL Anywhere. -->
<!-- default_dbname: Override the default database (postgres) to connect to for PostgreSQL. -->
<!-- sslmode: Determines whether or with what priority a SSL TCP/IP connection will be negotiated with the server for PostgreSQL. -->
<!-- sslrootcert: The name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. -->
<!-- pooled: True to use a pooled server with the oci8/pdo_oracle driver -->
Expand All @@ -480,6 +495,7 @@ Configuration Reference
servicename=""
sessionMode=""
server=""
default_dbname=""
sslmode=""
sslrootcert=""
pooled=""
Expand All @@ -495,6 +511,7 @@ Configuration Reference
<!-- servicename: Overrules dbname parameter if given and used as SERVICE_NAME or SID connection parameter for Oracle depending on the service parameter. -->
<!-- sessionMode: The session mode to use for the oci8 driver -->
<!-- server: The name of a running database server to connect to for SQL Anywhere. -->
<!-- default_dbname: Override the default database (postgres) to connect to for PostgreSQL. -->
<!-- sslmode: Determines whether or with what priority a SSL TCP/IP connection will be negotiated with the server for PostgreSQL. -->
<!-- sslrootcert: The name of a file containing SSL certificate authority (CA) certificate(s). If the file exists, the server's certificate will be verified to be signed by one of these authorities. -->
<!-- pooled: True to use a pooled server with the oci8/pdo_oracle driver -->
Expand All @@ -516,6 +533,7 @@ Configuration Reference
servicename=""
sessionMode=""
server=""
default_dbname=""
sslmode=""
sslrootcert=""
pooled=""
Expand Down Expand Up @@ -896,6 +914,7 @@ can configure. The following block shows all possible configuration keys:
service: true # Oracle specific (SERVICE_NAME instead of SID)
servicename: MyOracleServiceName # Oracle specific (SERVICE_NAME)
sessionMode: 2 # oci8 driver specific (session_mode)
default_dbname: database # PostgreSQL specific (default_dbname)
sslmode: require # PostgreSQL specific (LIBPQ-CONNECT-SSLMODE)
sslrootcert: postgresql-ca.pem # PostgreSQL specific (LIBPQ-CONNECT-SSLROOTCERT)
wrapper_class: MyDoctrineDbalConnectionWrapper
Expand Down Expand Up @@ -942,6 +961,7 @@ can configure. The following block shows all possible configuration keys:
service="true" <!-- Oracle specific (SERVICE_NAME instead of SID) -->
servicename="MyOracleServiceName" <!-- Oracle specific (SERVICE_NAME) -->
sessionMode"2" <!-- oci8 driver specific (session_mode) -->
default_dbname="database" <!-- PostgreSQL specific (default_dbname) -->
sslmode="require" <!-- PostgreSQL specific (LIBPQ-CONNECT-SSLMODE) -->
sslrootcert="postgresql-ca.pem" <!-- PostgreSQL specific (LIBPQ-CONNECT-SSLROOTCERT) -->
wrapper-class="MyDoctrineDbalConnectionWrapper"
Expand Down
3 changes: 2 additions & 1 deletion Tests/DependencyInjection/AbstractDoctrineExtensionTest.php
Expand Up @@ -63,9 +63,10 @@ public function testDbalLoadFromXmlMultipleConnections()
// doctrine.dbal.pgsql_connection
$config = $container->getDefinition('doctrine.dbal.pgsql_connection')->getArgument(0);
$this->assertSame('pdo_pgsql', $config['driver']);
$this->assertSame('pgsql_db', $config['dbname']);
$this->assertSame('pgsql_schema', $config['dbname']);
$this->assertSame('pgsql_user', $config['user']);
$this->assertSame('pgsql_s3cr3t', $config['password']);
$this->assertSame('pgsql_db', $config['default_dbname']);
$this->assertSame('require', $config['sslmode']);
$this->assertSame('postgresql-ca.pem', $config['sslrootcert']);
$this->assertSame('utf8', $config['charset']);
Expand Down
Expand Up @@ -42,9 +42,10 @@
<connection
name="pgsql"
driver="pdo_pgsql"
dbname="pgsql_db"
dbname="pgsql_schema"
user="pgsql_user"
password="pgsql_s3cr3t"
default_dbname="pgsql_db"
sslmode="require"
sslrootcert="postgresql-ca.pem"
charset="utf8" />
Expand Down
Expand Up @@ -31,9 +31,10 @@ doctrine:
protocol: TCPIP
pgsql:
driver: pdo_pgsql
dbname: pgsql_db
dbname: pgsql_schema
user: pgsql_user
password: pgsql_s3cr3t
default_dbname: pgsql_db
sslmode: require
sslrootcert: postgresql-ca.pem
charset: utf8
Expand Down