1Catalyst::TraitFor::ModUesClea:rt:aDClBoyInsCtt:r::i:SbTcurhtaeeimdtaF:Po:erSr:cl:hMeDomodacePulrm:oe:xnDytB(aI3tC)i:o:nSchema::SchemaProxy(3)
2
3
4

NAME

6       Catalyst::TraitFor::Model::DBIC::Schema::SchemaProxy - Proxy Schema
7       Methods and Options from Model
8

DESCRIPTION

10       Allows you to call your DBIx::Class::Schema methods directly on the
11       Model instance, and passes config options to your DBIx::Class::Schema
12       and DBIx::Class::ResultSet attributes at "BUILD" time.
13
14       Methods and attributes local to your "Model" take precedence over
15       DBIx::Class::Schema or DBIx::Class::ResultSet methods and attributes.
16

CREATING SCHEMA CONFIG ATTRIBUTES

18       To create attributes in your "Schema.pm", use either Moose or
19       Class::Accessor::Grouped, which is inherited from by all DBIx::Class
20       classes automatically. E.g.:
21
22           __PACKAGE__->mk_group_accessors(simple => qw/
23               config_key1
24               config_key2
25               ...
26           /);
27
28       Or with Moose:
29
30           use Moose;
31           has config_key1 => (is => 'rw', default => 'default_value');
32
33       This code can be added after the md5sum on DBIx::Class::Schema::Loader
34       generated schemas.
35
36       At app startup, any non-local options will be passed to these
37       accessors, and can be accessed as usual via "$schema->config_key1".
38
39       These config values go into your "Model::DB" block, along with normal
40       config values.
41

CREATING RESULTSET CONFIG ATTRIBUTES

43       You can create classdata on DBIx::Class::ResultSet classes to hold
44       values from Catalyst config.
45
46       The code for this looks something like this:
47
48           package MySchema::ResultSet::Foo;
49
50           use base 'DBIx::Class::ResultSet';
51
52           __PACKAGE__->mk_group_accessors(inherited => qw/
53               rs_config_key1
54               rs_config_key2
55               ...
56           /);
57           __PACKAGE__->rs_config_key1('default_value');
58
59       Or, if you prefer Moose:
60
61           package MySchema::ResultSet::Foo;
62
63           use Moose;
64           use MooseX::NonMoose;
65           use MooseX::ClassAttribute;
66           extends 'DBIx::Class::ResultSet';
67
68           sub BUILDARGS { $_[2] } # important
69
70           class_has rs_config_key1 => (is => 'rw', default => 'default_value');
71
72           ...
73
74           __PACKAGE__->meta->make_immutable;
75
76           1;
77
78       In your catalyst config, use the generated Model name as the config
79       key, e.g.:
80
81           <Model::DB::Users>
82               strict_passwords 1
83           </Model::DB::Users>
84

SEE ALSO

86       Catalyst::Model::DBIC::Schema, DBIx::Class::Schema
87

AUTHOR

89       See "AUTHOR" in Catalyst::Model::DBIC::Schema and "CONTRIBUTORS" in
90       Catalyst::Model::DBIC::Schema.
91
93       See "COPYRIGHT" in Catalyst::Model::DBIC::Schema.
94

LICENSE

96       This program is free software, you can redistribute it and/or modify it
97       under the same terms as Perl itself.
98
99
100
101perl v5.36.0           Catalyst::T2r0a2i3t-F0o1r-:2:0Model::DBIC::Schema::SchemaProxy(3)
Impressum