The problem is that I have 2 + databases defined in Symfony. And when I update table schema with
php app/console dotrine:schema:update --force
it makes the tables in the default database. I’d like to specify which database the table belongs to. How could i do that?
I’m using yaml(yml) format for the entities, example:
Test\ExampleBundle\Entity\TestTable:
type: entity
table: test_table
id:
id:
type: integer
generator:
strategy: AUTO
fields:
name:
type: string
length: 255
sound:
type: smallint
Take a deeper look at How to work with Multiple Entity Managers and Connections section of the documentation.
Doctrine offers you the ability to have multiple connections. You can easily add entity managers to bind your entities to different predefined connections according to the bundles they belong to.
According to the documentation, you can bind bundles to entity managers, but here is A trick on how to use two entity managers in the same bundle,
If you want to bind entities from one bundle to different entity managers you can add a “dir” attribute to define a path to a specific entities folder.
Example,
You can then put your bundle entities into the right folders according to the connection they are bound to.