Using Multi Database In Symfony

all:
database1:
class: sfPropelDatabase
param:
dsn: pgsql://foo:bar@hostname/database1

database2:
class: sfPropelDatabase
param:
dsn: mysql://foo:bar@hostname/database2

Create one
PROJECT_DIR/config/database1.schema.xml
Create another one
PROJECT_DIR/config/database2.schema.xml

Rebuild DB model:

$ symfony propel-build-model

$database1_connection_handler = Propel::getConnection(FooPeer::DATABASE_NAME);
$database2_connection_handler = Propel::getConnection(BarPeer::DATABASE_NAME);
Share