Skip to content

Commit ad790f2

Browse files
committed
Document schema update with multiple em
1 parent e940a07 commit ad790f2

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

cookbook/doctrine/multiple_entity_managers.rst

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,17 @@ and ``customer``. The ``default`` entity manager manages entities in the
4242
manager manages entities in the ``AcmeCustomerBundle``.
4343

4444
When working with multiple entity managers, you should be explicit about which
45-
entity manager you want. If you *do* omit the entity manager's name when
46-
asking for it, the default entity manager (i.e. ``default``) is returned::
45+
entity manager you want. If you *do* omit the entity manager's name when you
46+
update your schema, the default (i.e. ``default``) is used::
47+
48+
# Play only with "default" mappings
49+
php app/console doctrine:schema:update --force
50+
51+
# Play only with "customer" mappings
52+
php app/console doctrine:schema:update --force --em=customer
53+
54+
If you *do* omit the entity manager's name when asking for it,
55+
the default entity manager (i.e. ``default``) is returned::
4756

4857
class UserController extends Controller
4958
{
@@ -52,7 +61,7 @@ asking for it, the default entity manager (i.e. ``default``) is returned::
5261
// both return the "default" em
5362
$em = $this->get('doctrine')->getEntityManager();
5463
$em = $this->get('doctrine')->getEntityManager('default');
55-
64+
5665
$customerEm = $this->get('doctrine')->getEntityManager('customer');
5766
}
5867
}

0 commit comments

Comments
 (0)