[Dbix-class] how to select from two tables ?

eden edencardim at gmail.com
Mon Sep 17 10:04:47 GMT 2007


On 9/15/07, Jason Kohles <email at jasonkohles.com> wrote:
> $row->uid->uname, although you probably want to rename the
> relationship so it makes more sense, by including
>
> My::Schema::News->belongs_to( 'author', 'My::Schema::Author', 'uid' );
>
> Then you can get it as;
>
> $row->author->uname;

You can also use the proxy attribute:

My::Schema::News->belongs_to( 'author', 'My::Schema::Author', 'uid', {
proxy => [qw/uname/]} );

$row->uname; # will automatically call $row->author->uname

-- 
edenc.vox.com



More information about the DBIx-Class mailing list