Consider the following configuration file:
config.yml
doctrine:
dbal:
default_connection: slqX45
connections:
slqX44:
driver: pdo_mysql
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
slqX45:
driver: pdo_mysql
host: "%database_host_co%"
port: "%database_port_co%"
dbname: "%database_name_co%"
user: "%database_user_co%"
password: "%database_password_co%"
charset: UTF8
Notice that the connection marked as default is sqlX45
.
However I have some entities that have their respective tables in the A
database and others in the B
database, so the need to use 2 connections.
When you execute the following commands in the console, you must specify which connection to use and which entity, for example:
app/console doctrine:generate:entities --entidade="EntidadeA" --conexao="slqX44"
app/console doctrine:schema:update --entidade="EntidadeA" --conexao="slqX44"
How to do this?