@Dziamid is half right.
You technically cannot join two tables over to separate database. But you can fake it would any real intervention.
Configure multiple database connections:
//databases.yml
all:
items_db:
class: sfDoctrineDatabase
param:
dsn: mysql://login:passwd@localhost/items
stores_db:
class: sfDoctrineDatabase
param:
dsn: mysql://login:passwd@localhost/stores
Define the proper connection for each model
//schema.yml
Item:
connection: items_db
columns:
store_id: integer(4)
relations:
Store:
local: store_id
foreign: id
foreignAlias: Items
Store:
connection: stores_db
columns:
name: string(255)
Now you can use your Doctrine models as you normally would:
// like this
$item = new Item();
$store = new Store();
$store->save();
$item->setStore($store);
// or like this
$item->getStore();
The only limitation is that you CANNOT do joins in DQL queries.
$query = Doctrine_Query::create()
->from('Store s')
->leftJoin('s.Items i')
->fetchAll();
But you can load relations using from Doctrine_Collections.
$stores = Doctrine::getTable('Store')->findAll(); // this returns a Doctrine_Collection
$stores->loadRelated('Items');
This works the same as the Doctrine_Query.