2 Catalyst::Model::DBIC::Schema - DBIx::Class::Schema Model Class
5 package MyApp::Model::Foo;
7 use base 'Catalyst::Model::DBIC::Schema';
10 schema_class => 'Foo::SchemaClass',
11 connect_info => [ 'dbi:Pg:dbname=foodb',
22 # ->schema To access schema methods:
23 $c->model('Foo')->schema->source(...);
25 # certain ->schema methods (source, resultset, class) have shortcuts
26 $c->model('Foo')->source(...);
27 $c->model('Foo')->resultset(...);
28 $c->model('Foo')->class(...);
30 # For resultsets, there's an even quicker shortcut:
32 # is the same as $c->model('Foo')->resultset('Bar')
34 # To get the composed schema for making new connections:
35 my $newconn = $c->model('Foo')->composed_schema->connect(...);
37 # Or the same thing via a convenience shortcut:
38 my $newconn = $c->model('Foo')->connect(...);
40 # or, if your schema works on different storage drivers:
41 my $newconn = $c->model('Foo')->composed_schema->clone();
42 $newconn->storage_type('::LDAP');
43 $newconn->connection(...);
45 # and again, a convenience shortcut
46 my $newconn = $c->model('Foo')->clone();
47 $newconn->storage_type('::LDAP');
48 $newconn->connection(...);
51 This is a Catalyst Model for DBIx::Class::Schema-based Models. See the
52 documentation for Catalyst::Helper::Model::DBIC::Schema and
53 Catalyst::Helper::Model::DBIC::SchemaInlineLoader for information on
54 generating these Models via Helper scripts.
58 This is the classname of your DBIx::Class::Schema Schema. It needs
59 to be findable in @INC, but it does not need to be underneath
60 "Catalyst::Model::". This parameter is required.
63 This is an arrayref of connection parameters, which are specific to
64 your "storage_type". For "::DBI", which is the only supported
65 "storage_type" in DBIx::Class at the time of this writing, the 4
66 parameters are your dsn, username, password, and connect options
69 This is not required if "schema_class" already has connection
70 information defined in itself (which would be the case for a Schema
71 defined by DBIx::Class::Schema::Loader, for instance).
74 Allows the use of a different "storage_type" than what is set in
75 your "schema_class" (which in turn defaults to "::DBI" if not set in
76 current DBIx::Class). Completely optional, and probably unneccesary
77 for most people, until other storage backends become available for
81 new Instantiates the Model based on the above-documented ->config
82 parameters. The only required parameter is "schema_class".
83 "connect_info" is required in the case that "schema_class" does not
84 already have connection information defined for it.
87 Accessor which returns the connected schema being used by the this
88 model. There are already direct shortcuts on the model class itself
89 for schema->resultset, schema->source, and schema->class.
92 Accessor which returns the composed schema, which has no connection
93 info, which was used in constructing the "schema" above. Useful for
94 creating new connections based on the same schema/model. There are
95 direct shortcuts from the model object for composed_schema->clone
96 and composed_schema->connect
99 Shortcut for ->composed_schema->clone
102 Shortcut for ->composed_schema->connect
105 Shortcut for ->schema->source
108 Shortcut for ->schema->class
111 Shortcut for ->schema->resultset
114 General Catalyst Stuff:
116 Catalyst::Manual, Catalyst::Test, Catalyst::Request, Catalyst::Response,
117 Catalyst::Helper, Catalyst,
119 Stuff related to DBIC and this Model style:
121 DBIx::Class, DBIx::Class::Schema, DBIx::Class::Schema::Loader,
122 Catalyst::Helper::Model::DBIC::Schema,
123 Catalyst::Helper::Model::DBIC::SchemaInlineLoader
126 Brandon L Black, "blblack@gmail.com"
129 This program is free software, you can redistribute it and/or modify it
130 under the same terms as Perl itself.