DBIx::Class::Relationship - Inter-table relationships
This class handles relationships between the tables in your database model. It allows your to set up relationships, and to perform joins on searches.
__PACKAGE__->add_relationship('relname', 'Foreign::Class', $cond, $attrs);
The condition needs to be an SQL::Abstract-style representation of the join between the tables - for example if you're creating a rel from Foo to Bar
{ 'foreign.foo_id' => 'self.id' }
will result in a JOIN clause like
foo me JOIN bar bar ON bar.foo_id = me.id
My::Table->search_related('relname', $cond, $attrs);
My::Table->count_related('relname', $cond, $attrs);
My::Table->create_related('relname', \%col_data);
My::Table->new_related('relname', \%col_data);
My::Table->find_related('relname', @pri_vals | \%pri_vals);
My::Table->find_or_create_related('relname', \%col_data);
My::Table->set_from_related('relname', $rel_obj);
My::Table->update_from_related('relname', $rel_obj);
My::Table->delete_related('relname', $cond, $attrs);
Matt S. Trout <mst@shadowcatsystems.co.uk>
You may distribute this code under the same terms as Perl itself.
To install DBIx::Class, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::Class
CPAN shell
perl -MCPAN -e shell install DBIx::Class
For more information on module installation, please visit the detailed CPAN module installation guide.