-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Multiple Entity Managers #1783
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
Multiple Entity Managers #1783
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. put |
||
|
||
# Play only with "customer" connection | ||
php app/console doctrine:database:create --connection=customer | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
|
||
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:: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be a bash code block too |
||
|
||
# Play only with "default" mappings | ||
php app/console doctrine:schema:update --force | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove one colon and put this after this line (including an empty line between them):