1 package DBIx::Class::Relationship;
6 use base qw/DBIx::Class/;
8 __PACKAGE__->load_own_components(qw/
18 __PACKAGE__->mk_classdata('_relationships', { } );
22 DBIx::Class::Relationship - Inter-table relationships
28 This class handles relationships between the tables in your database
29 model. It allows your to set up relationships, and to perform joins
32 This POD details only the convenience methods for setting up standard
33 relationship types. For more information see ::Relationship::Base
37 All convenience methods take a signature of the following format -
39 __PACKAGE__>method_name('relname', 'Foreign::Class', $join?, $attrs?);
47 my $f_obj = $obj->relname;
49 Creates a one-one relationship with another class; defaults to PK-PK for
50 the join condition unless a condition is specified.
54 my $f_obj = $obj->relname;
56 Creates an optional one-one relationship with another class; defaults to PK-PK
57 for the join condition unless a condition is specified.
61 my @f_obj = $obj->relname($cond?, $attrs?);
62 my $f_result_set = $obj->relname($cond?, $attrs?);
64 $obj->add_to_relname(\%col_data);
66 Creates a one-many relationship with another class;
70 my $f_obj = $obj->relname;
72 $obj->relname($new_f_obj);
74 Creates a relationship where we store the foreign class' PK; if $join is a
75 column name instead of a condition that is assumed to be the FK, if not
76 has_many assumes the FK is the relname is that is a column on the current
87 Matt S. Trout <mst@shadowcatsystems.co.uk>
91 You may distribute this code under the same terms as Perl itself.