Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
dcramble wants to merge3 commits intosymfony:masterfromdcramble:multi-em-config
Closed
Changes fromall 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
42 changes: 38 additions & 4 deletionscookbook/doctrine/multiple_entity_managers.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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:
Expand All@@ -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::
Copy link
Member

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):

.. code-block:: bash


# Play only with "default" connection
php app/console doctrine:database:create
Copy link
Member

Choose a reason for hiding this comment

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

put$ (with a space at the end)


# Play only with "customer" connection
php app/console doctrine:database:create --connection=customer
Copy link
Member

Choose a reason for hiding this comment

The 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::
Copy link
Member

Choose a reason for hiding this comment

The 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
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp