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

Support for 'url' parameter in config #352

Closed
wants to merge 3 commits into from
Closed
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
1 change: 1 addition & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ private function configureDbalDriverNode(ArrayNodeDefinition $node)
{
$node
->children()
->scalarNode('url')->info('A URL with connection information; any parameter value parsed from this string will override explicitly set parameters')->end()
->scalarNode('dbname')->end()
->scalarNode('host')->defaultValue('localhost')->end()
->scalarNode('port')->defaultNull()->end()
Expand Down
1 change: 1 addition & 0 deletions Resources/config/schema/doctrine-1.0.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
</xsd:attributeGroup>

<xsd:attributeGroup name="driver-config">
<xsd:attribute name="url" type="xsd:string" />
<xsd:attribute name="dbname" type="xsd:string" />
<xsd:attribute name="host" type="xsd:string" />
<xsd:attribute name="port" type="xsd:string" />
Expand Down
10 changes: 10 additions & 0 deletions Resources/doc/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,14 @@ Doctrine DBAL Configuration
accept, converted to the XML or YAML naming standards that Symfony
enforces. See the Doctrine `DBAL documentation`_ for more information.

.. note::

When specifying a "url" parameter, any information extracted from that
URL will override explicitly set parameters. An example database URL
would be "mysql://snoopy:redbaron@localhost/baseball", and any explicitly
set driver, user, password and dbname parameter would be overridden by
this URL. See the Doctrine `DBAL documentation`_ for more information.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the referenced URL somehow be improved? You will now reach the front page of the Doctrine DBAL documentation and you will then have to search for the right page explaining the option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for now, the Doctrine DBAL documentation on their website hasn't been updated in ages. Paging @beberlei.


Besides default Doctrine options, there are some Symfony-related ones that you
can configure. The following block shows all possible configuration keys:

Expand All @@ -276,6 +284,7 @@ can configure. The following block shows all possible configuration keys:

doctrine:
dbal:
url: mysql://user:secret@localhost:1234/otherdatabase # this would override the values below
dbname: database
host: localhost
port: 1234
Expand Down Expand Up @@ -316,6 +325,7 @@ can configure. The following block shows all possible configuration keys:
<doctrine:config>
<doctrine:dbal
name="default"
url="mysql://user:secret@localhost:1234/otherdatabase" <!-- this would override the values below -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the inline comment valid here? Never saw one in the middle of a tag, so I may be wrong here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, but the same is used further down, so I figured it didn't matter.

dbname="database"
host="localhost"
port="1234"
Expand Down