Here is a simple code snippet that demonstrates three-way table join management using Gantry::Utils::Threeway.
package Blog;
use Gantry::Utils::Threeway;
sub do_tag {
my( $self, $blog_id ) = @_;
my $threeway = Gantry::Utils::Threeway->new( {
self => $self,
primary_id => $blog_id,
primary_table => 'blog',
join_table => 'blog_tag',
secondary_table => 'tag'
} );
$threeway->process();
}
package Tag;
use Gantry::Utils::Threeway;
sub do_blog {
my( $self, $tag_id ) = @_;
my $threeway = Gantry::Utils::Threeway->new( {
self => $self,
primary_id => $tag_id,
primary_table => 'tag',
join_table => 'blog_tag',
secondary_table => 'blog'
} );
$threeway->process();
}