Looking for examples of cross-library operations under symfony 2
First configure multiple connections and corresponding managers:
doctrine: dbal: default_connection: default connections: db1: driver: "%database_driver%" host: "%database_host%" port: "%database_port%" dbname: "%database_name%" user: "%database_user%" password: "%database_password%" charset: UTF8 db2: driver: "%database_driver2%" host: "%database_host2%" port: "%database_port2%" dbname: "%database_name2%" user: "%database_user2%" password: "%database_password2%" charset: UTF8 orm: default_entity_manager: db1 entity_managers: db1: connection: db1 mappings: UsingDb1Bundle: ~ db2: connection: db2 mappings: UsingDb2Bundle: ~
The above configuration is to let the two bundles use different managers respectively. If you want to use a manager in a bundle, you can:
entity_managers: db1: connection: db1 mappings: db1: dir: Path/To/EntityFolder1 db2: connection: db2 mappings: db2: dir: Path/To/EntityFolder2
You have to separate entities into different folders.
With multiple managers, the use is no different from a single one. Pay attention to handing the object to the corresponding manager for processing.
First configure multiple connections and corresponding managers:
The above configuration is to let the two bundles use different managers respectively. If you want to use a manager in a bundle, you can:
You have to separate entities into different folders.
With multiple managers, the use is no different from a single one. Pay attention to handing the object to the corresponding manager for processing.