[Dbix-class] Relationships spanning multiple databases

Sam Crawley sam_crawley at warpmail.net
Fri Nov 24 09:27:17 GMT 2006


> > I thought I may be able to setup a relationship from one schema to the
> > other, and DBIC would just DWIM, e.g.
> >
> > App::Schema1::RS->belongs_to( 'rec_from_schema2' => 'App::Schema2::RS',
> > 'fk');
>
> That's undwimmable - DBIC has no way of knowing what $schema object to use on
> the other side, and a relationship in DBIC is expected to be a "proper" DB
> relationship, i.e. one you can join on.

Fair enough.

> > Is there any way I can roll my own?
>
> Use inflate_column - this is why where CDBI (which doesn't know what a JOIN
> is) has has_a for both FKs and inflates, DBIC keeps belongs_to and
> inflate_column separate.

Sounds good... but I'm unclear on how inflate_column gets the schema
of the 'foreign' database. Does this need to be passed to the original
schema at some point, so it's row
objects can access it?

Thanks.



More information about the Dbix-class mailing list