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

Added note about multiple database connections #296

Open
wants to merge 1 commit into
base: 1.0.x
Choose a base branch
from
Open
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
40 changes: 40 additions & 0 deletions Resources/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,46 @@ or in XML::
</stof_doctrine_extensions:config>
</container>

Functional Tests with multiple database connections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you write functional tests with multiple database connections using
`LiipFunctionalTestBundle`_, you can configure multiple database connections
like this:

.. code-block:: yaml

# app/config/config_test.yml

doctrine:
dbal:
default_connection: %testdb%
connections:
sqlite:
driver: pdo_sqlite
path: %kernel.cache_dir%/test.db
mysql:
driver: pdo_mysql
dbname: testdb
host: localhost
user: travis
pgsql:
driver: pdo_pgsql
dbname: testdb
host: localhost
user: travis

stof_doctrine_extensions:
default_locale: en_US
orm:
%testdb%:
tree: true

Then you can set the environment variable ``SYMFONY__TESTDB`` to your configured
database connection, and the extensions get automatically registered for
whichever database connection you are using.

.. _`LiipFunctionalTestBundle`: https://github.com/liip/LiipFunctionalTestBundle
.. _DoctrineExtensions: http://github.com/l3pp4rd/DoctrineExtensions
.. _blog: http://gediminasm.org/articles
.. _documentation: http://symfony.com/doc/current/reference/configuration/doctrine.html#configuration-overview