NAME Catalyst::Model::DBIC::Schema - DBIx::Class::Schema Model Class SYNOPSIS package MyApp::Model::Foo; use strict; use base 'Catalyst::Model::DBIC::Schema'; __PACKAGE__->config( schema_class => 'Foo::SchemaClass', connect_info => [ 'dbi:Pg:dbname=foodb', 'postgres', '', { AutoCommit => 1 }, ], ); 1; # In controller code: # ->schema To access schema methods: $c->model('Foo')->schema->source(...); # certain ->schema methods (source, resultset, class) have shortcuts $c->model('Foo')->source(...); $c->model('Foo')->resultset(...); $c->model('Foo')->class(...); # For resultsets, there's an even quicker shortcut: $c->model('Foo::Bar') # is the same as $c->model('Foo')->resultset('Bar') # To get the composed schema for making new connections: my $newconn = $c->model('Foo')->composed_schema->connect(...); # Or the same thing via a convenience shortcut: my $newconn = $c->model('Foo')->connect(...); # or, if your schema works on different storage drivers: my $newconn = $c->model('Foo')->composed_schema->clone(); $newconn->storage_type('::LDAP'); $newconn->connection(...); # and again, a convenience shortcut my $newconn = $c->model('Foo')->clone(); $newconn->storage_type('::LDAP'); $newconn->connection(...); DESCRIPTION This is a Catalyst Model for DBIx::Class::Schema-based Models. See the documentation for Catalyst::Helper::Model::DBIC::Schema and Catalyst::Helper::Model::DBIC::SchemaLoader for information on generating these Models via Helper scripts. The latter of the two will also generated a DBIx::Class::Schema::Loader-based Schema class for you. CONFIG PARAMETERS schema_class This is the classname of your DBIx::Class::Schema Schema. It needs to be findable in @INC, but it does not need to be underneath "Catalyst::Model::". This parameter is required. connect_info This is an arrayref of connection parameters, which are specific to your "storage_type". For "::DBI", which is the only supported "storage_type" in DBIx::Class at the time of this writing, the 4 parameters are your dsn, username, password, and connect options hashref. This is not required if "schema_class" already has connection information defined in itself (which would be the case for a Schema defined by DBIx::Class::Schema::Loader, for instance). storage_type Allows the use of a different "storage_type" than what is set in your "schema_class" (which in turn defaults to "::DBI" if not set in current DBIx::Class). Completely optional, and probably unnecessary for most people until other storage backends become available for DBIx::Class. METHODS new Instantiates the Model based on the above-documented ->config parameters. The only required parameter is "schema_class". "connect_info" is required in the case that "schema_class" does not already have connection information defined for it. schema Accessor which returns the connected schema being used by the this model. There are already direct shortcuts on the model class itself for schema->resultset, schema->source, and schema->class. composed_schema Accessor which returns the composed schema, which has no connection info, which was used in constructing the "schema" above. Useful for creating new connections based on the same schema/model. There are direct shortcuts from the model object for composed_schema->clone and composed_schema->connect clone Shortcut for ->composed_schema->clone connect Shortcut for ->composed_schema->connect source Shortcut for ->schema->source class Shortcut for ->schema->class resultset Shortcut for ->schema->resultset storage Provides an accessor for the connected schema's storage object. Used often for debugging and controlling transactions. SEE ALSO General Catalyst Stuff: Catalyst::Manual, Catalyst::Test, Catalyst::Request, Catalyst::Response, Catalyst::Helper, Catalyst, Stuff related to DBIC and this Model style: DBIx::Class, DBIx::Class::Schema, DBIx::Class::Schema::Loader, Catalyst::Helper::Model::DBIC::Schema, Catalyst::Helper::Model::DBIC::SchemaLoader AUTHOR Brandon L Black, "blblack@gmail.com" COPYRIGHT This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.