Andy Grundman > DBIx-Class-0.03003 > DBIx::Class::Relationship::Base

Download:
DBIx-Class-0.03003.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  11
Open  18
Stalled  11
View/Report Bugs
Source   Latest Release: DBIx-Class-0.082801

NAME ^

DBIx::Class::Relationship::Base - Inter-table relationships

SYNOPSIS ^

DESCRIPTION ^

This class handles relationships between the tables in your database model. It allows your to set up relationships, and to perform joins on searches.

METHODS ^

add_relationship
  __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
search_related
  My::Table->search_related('relname', $cond, $attrs);
count_related
  My::Table->count_related('relname', $cond, $attrs);
create_related
  My::Table->create_related('relname', \%col_data);
new_related
  My::Table->new_related('relname', \%col_data);
find_related
  My::Table->find_related('relname', @pri_vals | \%pri_vals);
find_or_create_related
  My::Table->find_or_create_related('relname', \%col_data);
set_from_related
  My::Table->set_from_related('relname', $rel_obj);
update_from_related
  My::Table->update_from_related('relname', $rel_obj);
delete_related
  My::Table->delete_related('relname', $cond, $attrs);

AUTHORS ^

Matt S. Trout <mst@shadowcatsystems.co.uk>

LICENSE ^

You may distribute this code under the same terms as Perl itself.

syntax highlighting: