1Storm::Model(3)       User Contributed Perl Documentation      Storm::Model(3)
2
3
4

NAME

6       Storm::Object - Build objects to use with Storm
7

SYNOPSIS

9           package Foo;
10           use Storm::Object;  # provides Moose sugar
11
12           has 'id' => (
13               isa => 'Int',
14               traits => [qw( PrimaryKey AutoIncrement )],
15           );
16
17           has 'label' => (
18               isa => 'Str',
19           );
20
21           has 'bar' => (
22               isa => 'Bar',
23               weak_ref => 1,
24           )
25
26
27           package Bar;
28
29           has 'id' => (
30               isa => 'Int',
31               traits => [qw( PrimaryKey AutoIncrement )],
32           );
33
34           has_many 'foos' => (
35               foreign_class => 'Foo',
36               match_on => 'bar',
37               handles => {
38                   foos => 'iter',
39               }
40           );
41
42           has_many 'bazzes' => (
43               foreign_class => 'Baz',
44               junction_table => 'BazBars',
45               local_match => 'bar',
46               foreign_match => 'baz',
47               handles => {
48                   bazzes => 'iter',
49                   add_baz => 'add',
50                   remove_baz => 'remove',
51               }
52           );
53
54           package Baz;
55
56           has 'id' => (
57               isa => 'Int',
58               traits => [qw( PrimaryKey AutoIncrement )],
59           );
60
61           has_many 'bars' => (
62               foreign_class => 'Foo',
63               junction_table => 'BazBars',
64               local_match => 'bar',
65               foreign_match => 'baz',
66               handles => {
67                   bars => 'iter',
68                   add_bar => 'add',
69                   remove_bar => 'remove',
70               }
71           );
72

DESCRIPTION

74       Storm::Object is an extension of the "Moose" object system. The purpose
75       of Storm::Object is to apply the necessary meta-roles Storm needs to
76       introspect your objects and to provide sugar for declaring
77       relationships between Storm enabled objects.
78

ROLES/META-ROLES

80       Storm::Role::Object
81           This role is applied to the base class.
82
83       Storm::Role::Object::Meta::Attribute
84           This role is applied to the attribute meta-class.
85
86       Storm::Role::Object::Meta::Class
87           This role is applied to the class meta-class.
88

SUGAR

90       has_many $name => %options
91           foreign_class => $class
92               Set the foreign_class option to the other class in the
93               relationship.
94
95           match_on => $attribute_name
96               Use when defining a one-to-many relationsuhip. This is the name
97               of attribute in the foreign class used to define the
98               relationship.
99
100           junction_table => $table
101               Use when defining a many-to-many relationship. This is the
102               database table used to define the relationships.
103
104           local_match => $table
105               Use when defining a many-to-many relationship. This is the
106               column in the junction_table which is to identify the
107               __PACKAGE__ object in the relationship.
108
109           foreign_match => $table
110               Use when defining a many-to-many relationship. This is the
111               column in the junction_table which is to identify the foreign
112               object in the relationship.
113

AUTHOR

115       Jeffrey Ray Hallock <jeffrey.hallock at gmail dot com>
116
118           Copyright (c) 2010 Jeffrey Ray Hallock. All rights reserved.
119           This program is free software; you can redistribute it and/or
120           modify it under the same terms as Perl itself.
121
122
123
124perl v5.32.0                      2020-07-28                   Storm::Model(3)
Impressum