How to define the relations of 2 tables across 2 databases?

Suppose that I have two tables: userA and userB. The userA resides in databaseA, and the userB resides in databaseB. Each database has its own connection account.

Their relationship looks like this:




  databaseA                    databaseB

+------------+               +------------+

|   userA    |               |   userB    |

+------------+               +------------+

| id         | ------------> | id         |

| ...        |               | username   |

|            |               | passowrd   |

|            |               | ...        |

+------------+               +------------+



Now, how to define the relations of 2 tables, so that I can perform CRUD over both table?

I know that I am not going to help you, but…

If it’s difficult to have two AR targeting to different databases in same project, imagine relationate them :o

Isn’t that similar to what was discussed as “sharding” here?

http://www.yiiframework.com/forum/index.php?/topic/3960-sharding/page__hl__sharding__fromsearch__1

Well, it looks good. I will try it out. Thanks.