1DBIx::Class::Helpers(3)User Contributed Perl DocumentatioDnBIx::Class::Helpers(3)
2
3
4

NAME

6       DBIx::Class::Helpers - Simplify the common case stuff for DBIx::Class.
7

SYNOPSIS

9        package MyApp::Schema::Result::Foo_Bar;
10
11        __PACKAGE__->load_components(qw{Helper::JoinTable Core});
12
13        __PACKAGE__->join_table({
14           left_class   => 'Foo',
15           left_method  => 'foo',
16           right_class  => 'Bar',
17           right_method => 'bar',
18        });
19
20        # define parent class
21        package ParentSchema::Result::Bar;
22
23        use strict;
24        use warnings;
25
26        use parent 'DBIx::Class';
27
28        __PACKAGE__->load_components('Core');
29
30        __PACKAGE__->table('Bar');
31
32        __PACKAGE__->add_columns(qw/ id foo_id /);
33
34        __PACKAGE__->set_primary_key('id');
35
36        __PACKAGE__->belongs_to( foo => 'ParentSchema::Result::Foo', 'foo_id' );
37
38        # define subclass
39        package MySchema::Result::Bar;
40
41        use strict;
42        use warnings;
43
44        use parent 'ParentSchema::Result::Bar';
45
46        __PACKAGE__->load_components(qw{Helper::SubClass Core});
47
48        __PACKAGE__->subclass;
49

SEE ALSO

51       DBIx::Class::Helper::Row::JoinTable,
52       DBIx::Class::Helper::Row::SubClass, DBIx::Class::Helpers::Util
53

AUTHOR

55       Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
56
58       This software is copyright (c) 2019 by Arthur Axel "fREW" Schmidt.
59
60       This is free software; you can redistribute it and/or modify it under
61       the same terms as the Perl 5 programming language system itself.
62
63
64
65perl v5.30.0                      2019-08-30           DBIx::Class::Helpers(3)
Impressum