I'm following the documentation here:
These are the commands
php app/console doctrine:mapping:convert xml ./src/Acme/BlogBundle/Resources/config/doctrine/metadata/orm --from-database --force
php app/console doctrine:mapping:import AcmeBlogBundle annotation
php app/console doctrine:generate:entities AcmeBlogBundle
I see the new Entities here in"
Acme/BlogBundle/AcmeBlogBundle/Entity
But I wanted to know how I could add the Entities into their own namespace like this
Acme/BlogBundle/AcmeBlogBundle/Entity/Foo
Acme/BlogBundle/AcmeBlogBundle/Entity/Bar
This is so I could keep the Entities for Foo and Bar Databases separated.
UPDATE:
Or should it be structured like this:
Acme/BlogBundle/AcmeBlogBundle/Foo/Entity
Acme/BlogBundle/AcmeBlogBundle/Bar/Entity
Thoughts?
If you take a look at How to work with Multiple Entity Managers and Connections section of the documentation, you'll notice that you can bind your bundle entities to one or many entity managers. Each one of them related to a specific database connection.
If for example I've defined two database connections (first_connection and second_connection), I can than add two entity managers as follow,
You can then specify the right Entity Manager to use during the two first steps of the entity generation process,
Note: The
--filter
option is used to allow you generate your entities individually.Your entities are then put into the right folders according to the connection the were bound to.