[Dbix-class] Relationships spanning multiple databases

Mike Friedman friedo at friedo.com
Mon Nov 27 22:40:31 GMT 2006


On 11/24/06, Sam Crawley <sam_crawley at warpmail.net> wrote:

> 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?



You could make your inflate_column methods closures over the other DB's
schema object.

For example, in your table class:

my $other_schema =3D DB::Other->connect( ... );
__PACKAGE__->inflate_column( fkey_col =3D> { inflate =3D> sub {
$other_schema->resultset('Table')->search( { id =3D> shift } ) },
                                         deflate =3D> sub { shift->id } } );
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20061127/ff6=
9f829/attachment.htm


More information about the Dbix-class mailing list