minor docs update, use connection not connect after manually cloning from composed_schema
[catagits/Catalyst-Model-DBIC-Schema.git] / lib / Catalyst / Helper / Model / DBIC / Schema.pm
CommitLineData
ad91060a 1package Catalyst::Helper::Model::DBIC::Schema;
2
3use strict;
0f2fd2c0 4use warnings;
5use Carp;
ad91060a 6
7=head1 NAME
8
9Catalyst::Helper::Model::DBIC::Schema - Helper for DBIC Schema Models
10
11=head1 SYNOPSIS
12
0f2fd2c0 13 script/create.pl model Foo DBIC::Schema Foo::SchemaClass [ dsn user password ]
14
15 Where:
16 Foo is the short name for the Model class being generated
17 Foo::SchemaClass is the fully qualified classname of your Schema,
18 which isa DBIx::Class::Schema defined elsewhere.
19 dsn, user, and password are optional if connection info is already
20 defined in your Schema class (as it would be in the case of
21 DBIx::Class::Schema::Loader).
ad91060a 22
23=head1 DESCRIPTION
24
25Helper for the DBIC Plain Models.
26
27=head2 METHODS
28
29=head3 mk_compclass
30
31=cut
32
33sub mk_compclass {
0f2fd2c0 34 my ( $self, $helper, $schema_class, $dsn, $user, $pass ) = @_;
35
36 $helper->{schema_class} = $schema_class || '';
37
38 if(defined($dsn)) {
39 $helper->{setup_connect_info} = 1;
40 $helper->{dsn} = $dsn || '';
41 $helper->{user} = $user || '';
42 $helper->{pass} = $pass || '';
43 }
44
ad91060a 45 my $file = $helper->{file};
46 $helper->render_file( 'compclass', $file );
47}
48
49=head1 SEE ALSO
50
51L<Catalyst::Manual>, L<Catalyst::Test>, L<Catalyst::Request>,
52L<Catalyst::Response>, L<Catalyst::Helper>
53
54=head1 AUTHOR
55
56Brandon L Black, C<blblack@gmail.com>
57
58=head1 LICENSE
59
60This library is free software, you can redistribute it and/or modify
61it under the same terms as Perl itself.
62
63=cut
64
dce0dfe8 651;
66
ad91060a 67__DATA__
68
69__compclass__
70package [% class %];
71
72use strict;
73use base 'Catalyst::Model::DBIC::Schema';
74
75__PACKAGE__->config(
0f2fd2c0 76 schema_class => '[% schema_class %]',
77 [% IF setup_connect_info %]
ad91060a 78 connect_info => [ '[% dsn %]',
79 '[% user %]',
80 '[% pass %]',
81 {
82 RaiseError => 1,
83 PrintError => 0,
84 ShowErrorStatement => 1,
85 TraceLevel => 0,
86 AutoCommit => 1,
87 }
88 ],
0f2fd2c0 89 [% END %]
ad91060a 90);
91
92=head1 NAME
93
94[% class %] - Catalyst DBIC Plain Model
95
96=head1 SYNOPSIS
97
98See L<[% app %]>
99
100=head1 DESCRIPTION
101
102Catalyst::Model::DBIC::Schema Model
103
104=head1 AUTHOR
105
106[% author %]
107
108=head1 LICENSE
109
110This library is free software, you can redistribute it and/or modify
111it under the same terms as Perl itself.
112
113=cut
114
1151;