File: README

package info (click to toggle)
libdbix-class-helpers-perl 2.036000-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,008 kB
  • sloc: perl: 5,041; sql: 537; makefile: 7
file content (48 lines) | stat: -rw-r--r-- 1,083 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
SYNOPSIS

     package MyApp::Schema::Result::Foo_Bar;
    
     __PACKAGE__->load_components(qw{Helper::JoinTable Core});
    
     __PACKAGE__->join_table({
        left_class   => 'Foo',
        left_method  => 'foo',
        right_class  => 'Bar',
        right_method => 'bar',
     });
    
     # define parent class
     package ParentSchema::Result::Bar;
    
     use strict;
     use warnings;
    
     use parent 'DBIx::Class';
    
     __PACKAGE__->load_components('Core');
    
     __PACKAGE__->table('Bar');
    
     __PACKAGE__->add_columns(qw/ id foo_id /);
    
     __PACKAGE__->set_primary_key('id');
    
     __PACKAGE__->belongs_to( foo => 'ParentSchema::Result::Foo', 'foo_id' );
    
     # define subclass
     package MySchema::Result::Bar;
    
     use strict;
     use warnings;
    
     use parent 'ParentSchema::Result::Bar';
    
     __PACKAGE__->load_components(qw{Helper::SubClass Core});
    
     __PACKAGE__->subclass;

SEE ALSO

    DBIx::Class::Helper::Row::JoinTable,
    DBIx::Class::Helper::Row::SubClass, DBIx::Class::Helpers::Util