diff --git a/cookbook/doctrine/multiple_entity_managers.rst b/cookbook/doctrine/multiple_entity_managers.rst index 37e89923908..92150f9ee5b 100644 --- a/cookbook/doctrine/multiple_entity_managers.rst +++ b/cookbook/doctrine/multiple_entity_managers.rst @@ -23,6 +23,26 @@ The following configuration code shows how you can configure two entity managers .. code-block:: yaml doctrine: + dbal: + default_connection: default + connections: + default: + driver: %database_driver% + host: %database_host% + port: %database_port% + dbname: %database_name% + user: %database_user% + password: %database_password% + charset: UTF8 + customer: + driver: %database_driver2% + host: %database_host2% + port: %database_port2% + dbname: %database_name2% + user: %database_user2% + password: %database_password2% + charset: UTF8 + orm: default_entity_manager: default entity_managers: @@ -39,11 +59,25 @@ The following configuration code shows how you can configure two entity managers In this case, you've defined two entity managers and called them ``default`` and ``customer``. The ``default`` entity manager manages entities in the ``AcmeDemoBundle`` and ``AcmeStoreBundle``, while the ``customer`` entity -manager manages entities in the ``AcmeCustomerBundle``. +manager manages entities in the ``AcmeCustomerBundle``. You've also defined +two connections, one for each entity manager. + +.. note:: + + When working with multiple connections and entity managers, you should be + explicit about which configuration you want. If you *do* omit the name of + the connection or entity manager, the default (i.e. ``default``) is used. + + +When working with multiple connections to create your databases:: + + # Play only with "default" connection + php app/console doctrine:database:create + + # Play only with "customer" connection + php app/console doctrine:database:create --connection=customer -When working with multiple entity managers, you should be explicit about which -entity manager you want. If you *do* omit the entity manager's name when you -update your schema, the default (i.e. ``default``) is used:: +When working with multiple entity managers to update your schema:: # Play only with "default" mappings php app/console doctrine:schema:update --force pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy