Catalyst-Model-DBIC-Schema
view release on metacpan or search on metacpan
Array of Traits to apply to the instance. Traits are Moose::Roles.
They are relative to the "MyApp::TraitFor::Model::DBIC::Schema::", then
the "Catalyst::TraitFor::Model::DBIC::Schema::" namespaces, unless
prefixed with "+" in which case they are taken to be a fully qualified
name. E.g.:
traits Caching
traits +MyApp::TraitFor::Model::Foo
A new instance is created at application time, so any consumed required
attributes, coercions and modifiers will work.
Traits are applied at "COMPONENT" in Catalyst::Component time using
CatalystX::Component::Traits.
"ref $self" will be an anon class if any traits are applied,
"$self->_original_class_name" will be the original class.
When writing a Trait, interesting points to modify are "BUILD", "setup"
and "ACCEPT_CONTEXT".
Traits that come with the distribution:
Catalyst::TraitFor::Model::DBIC::Schema::Caching
Catalyst::TraitFor::Model::DBIC::Schema::Replicated
Catalyst::TraitFor::Model::DBIC::Schema::SchemaProxy
Catalyst::TraitFor::Model::DBIC::Schema::PerRequestSchema
compose_namespaces
This model calls "compose_namespace" in DBIx::Class::Schema by default
to install classes into the model namespaces. You can turn that off by
setting this attribute to false. Default is true.
install_model_shortcuts
If you don't want shortcut models so you can do e.g.
"$c->model('DB::Book')" set this attribute to false, Default is true.
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.
ATTRIBUTES
The keys you pass in the model configuration are available as
attributes.
Other attributes available:
connect_info
Your connect_info args normalized to hashref form (with
dsn/user/password.) See "connect_info" in DBIx::Class::Storage::DBI for
more info on the hashref form of "connect_info".
model_name
The model name Catalyst uses to resolve this model, the part after
"::Model::" or "::M::" in your class name. E.g. if your class name is
"MyApp::Model::DB" the "model_name" will be "DB".
_default_cursor_class
What to reset your "cursor_class" in DBIx::Class::Storage::DBI to if a
custom one doesn't work out. Defaults to
DBIx::Class::Storage::DBI::Cursor.
ATTRIBUTES FROM MooseX::Traits::Pluggable
_original_class_name
The class name of your model before any "traits" are applied. E.g.
"MyApp::Model::DB".
_traits
Unresolved arrayref of traits passed in the config.
_resolved_traits
Traits you used resolved to full class names.
CONFIGURING YOUR SCHEMA AND RESULTSETS
See the documentation for
Catalyst::TraitFor::Model::DBIC::Schema::SchemaProxy for instructions on
how to pass config values from your Catalyst config to your
DBIx::Class::Schema and/or DBIx::Class::ResultSet classes.
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 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". 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
If "compose_namespaces" is not true, "composed_schema" is equivalent to
"$model->schema_class->clone".
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
txn_do
Shortcut for ->schema->txn_do
( run in 1.511 second using v1.01-cache-2.11-cpan-39bf76dae61 )