Symfony 2: creating objects from multiple databases

Here is my configuration file:

# Doctrine Configuration doctrine: dbal: default_connection: flux connections: flux: driver: %db_flux_driver% host: %db_flux_host% port: %db_flux_port% dbname: %db_flux_name% user: %db_flux_user% password: %db_flux_password% charset: UTF8 commun: driver: %db_commun_driver% host: %db_commun_host% port: %db_commun_port% dbname: %db_commun_name% user: %db_commun_user% password: %db_commun_password% charset: UTF8 orm: default_entity_manager: default entity_managers: default: connection: flux mappings: CreatisSaisieBundle: ~ commun: connection: commun mappings: CreatisSaisieBundle: ~ 

As you can see, I use 2 connections.

I used the app / console doctination: mapping: convert xml doctrine to generate my xm orm files, but it only generated entities from my default connection (flux).

Is there an option that allows you to create objects from a specific connection or from all of them?

+4
source share
1 answer

I tested this command to create an entity for my application, it seems to work:

 php app/console doctrine:mapping:convert --em="ENTITY_MANAGER" --from-database yml ./src/NAMESPACE/NAMEBundle/Resources/config/doctrine/metadata/orm 
+2
source

Source: https://habr.com/ru/post/1385874/


All Articles