[jifty-devel] Jifty Model interface for JOIN keyword
Jesse Vincent
jesse at bestpractical.com
Wed Nov 15 14:41:30 EST 2006
On Wed, Nov 15, 2006 at 02:38:11PM -0500, C.G. LEE wrote:
> Hi there,
>
> Now I've got stuck to the JOIN keyword of SQL. As you guys know, joining the
> tables is very common.
>
> By using the Jifty Model Schema, can I get the same effect with the JOIN to
> the table stucture? or do I have to use another way(i.e., help with the
> Jifty Action)?
Here's a bit of code that might help:
sub associated_members {
my $self = shift;
my $users = CommitBit::Model::ProjectMemberCollection->new();
my $projects = $users->join(
column1 => 'project',
table2 => 'projects',
column2 => 'id'
);
my $repositories = $users->join(
alias1 => $projects,
column1 => 'repository',
table2 => 'repositories',
column2 => 'id'
);
$users->limit(
alias => $repositories,
column => 'id',
value => $self->id
);
return $users;
}
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
--
More information about the jifty-devel
mailing list