3 DBIx::Class::Manual::Cookbook - Misc receipes
7 =item Input validation.
11 =item Many-to-many relationships
13 This is not as easy as it could be, but it's possible. Here's an example to
18 use base qw/DBIx::Class/;
20 __PACKAGE__->load_components(qw/Core DB/);
21 __PACKAGE__->connection(...);
27 __PACKAGE__->table('left');
28 __PACKAGE__->add_columns(qw/id left_stuff/);
29 __PACKAGE__->set_primary_key(qw/id/);
30 __PACKAGE__->has_many('mid' => 'Mid');
35 { 'left.id' => $self->id },
36 { join => { 'mid' => 'left' }});
43 __PACKAGE__->table('mid');
44 __PACKAGE__->add_columns(qw/left right/);
45 __PACKAGE__->set_primary_key(qw/left right/);
47 __PACKAGE__->belongs_to('left' => 'Left');
48 __PACKAGE__->belongs_to('right' => 'Right');
54 __PACKAGE__->table('right');
55 __PACKAGE__->add_columns(qw/id right_stuff/);
56 __PACKAGE__->set_primary_key(qw/id/);
57 __PACKAGE__->has_many('mid' => 'Mid');
62 { 'right.id' => $self->id },
63 { join => { 'mid' => 'right' });
66 =item Advanced Exception handling