Visit Our UNIX and Linux User Community

Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

dbix::class::schema::loader::relbuilder(3pm) [debian man page]

DBIx::Class::Schema::Loader::RelBuilder(3pm)		User Contributed Perl Documentation	      DBIx::Class::Schema::Loader::RelBuilder(3pm)

DBIx::Class::Schema::Loader::RelBuilder - Builds relationships for DBIx::Class::Schema::Loader SYNOPSIS
See DBIx::Class::Schema::Loader and DBIx::Class::Schema::Loader::Base. DESCRIPTION
This class builds relationships for DBIx::Class::Schema::Loader. This is module is not (yet) for external use. METHODS
new Arguments: $loader object generate_code Arguments: [ [ local_moniker1 (scalar), fk_info1 (arrayref), uniq_info1 (arrayref) ] [ local_moniker2 (scalar), fk_info2 (arrayref), uniq_info2 (arrayref) ] ... ] This generates the code for the relationships of each table. "local_moniker" is the moniker name of the table which had the REFERENCES statements. The fk_info arrayref's contents should take the form: [ { local_table => 'some_table', local_moniker => 'SomeTable', local_columns => [ 'col2', 'col3' ], remote_table => 'another_table_moniker', remote_moniker => 'AnotherTableMoniker', remote_columns => [ 'col5', 'col7' ], }, { local_table => 'some_other_table', local_moniker => 'SomeOtherTable', local_columns => [ 'col1', 'col4' ], remote_table => 'yet_another_table_moniker', remote_moniker => 'YetAnotherTableMoniker', remote_columns => [ 'col1', 'col2' ], }, # ... ], The uniq_info arrayref's contents should take the form: [ [ uniq_constraint_name => [ 'col1', 'col2' ], ], [ another_uniq_constraint_name => [ 'col1', 'col2' ], ], ], This method will return the generated relationships as a hashref keyed on the class names. The values are arrayrefs of hashes containing method name and arguments, like so: { 'Some::Source::Class' => [ { method => 'belongs_to', arguments => [ 'col1', 'Another::Source::Class' ], { method => 'has_many', arguments => [ 'anothers', 'Yet::Another::Source::Class', 'col15' ], ], 'Another::Source::Class' => [ # ... ], # ... } AUTHOR
See "AUTHOR" in DBIx::Class::Schema::Loader and "CONTRIBUTORS" in DBIx::Class::Schema::Loader. LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-06-08 DBIx::Class::Schema::Loader::RelBuilder(3pm)

Check Out this Related Man Page

Catalyst::TraitFor::Model::DBIC::Schema::SchemaProxy(3pmUser Contributed Perl DocumentatiCatalyst::TraitFor::Model::DBIC::Schema::SchemaProxy(3pm)

Catalyst::TraitFor::Model::DBIC::Schema::SchemaProxy - Proxy Schema Methods and Options from Model DESCRIPTION
Allows you to call your DBIx::Class::Schema methods directly on the Model instance, and passes config options to your DBIx::Class::Schema and DBIx::Class::ResultSet attributes at "BUILD" time. Methods and attributes local to your "Model" take precedence over DBIx::Class::Schema or DBIx::Class::ResultSet methods and attributes. CREATING SCHEMA CONFIG ATTRIBUTES
To create attributes in your "", use either Moose or Class::Accessor::Grouped, which is inherited from by all DBIx::Class classes automatically. E.g.: __PACKAGE__->mk_group_accessors(simple => qw/ config_key1 config_key2 ... /); Or with Moose: use Moose; has config_key1 => (is => 'rw', default => 'default_value'); This code can be added after the md5sum on DBIx::Class::Schema::Loader generated schemas. At app startup, any non-local options will be passed to these accessors, and can be accessed as usual via "$schema->config_key1". These config values go into your "Model::DB" block, along with normal config values. CREATING RESULTSET CONFIG ATTRIBUTES
You can create classdata on DBIx::Class::ResultSet classes to hold values from Catalyst config. The code for this looks something like this: package MySchema::ResultSet::Foo; use base 'DBIx::Class::ResultSet'; __PACKAGE__->mk_group_accessors(inherited => qw/ rs_config_key1 rs_config_key2 ... /); __PACKAGE__->rs_config_key1('default_value'); Or, if you prefer Moose: package MySchema::ResultSet::Foo; use Moose; use MooseX::NonMoose; use MooseX::ClassAttribute; extends 'DBIx::Class::ResultSet'; sub BUILDARGS { $_[2] } # important class_has rs_config_key1 => (is => 'rw', default => 'default_value'); ... __PACKAGE__->meta->make_immutable; 1; In your catalyst config, use the generated Model name as the config key, e.g.: <Model::DB::Users> strict_passwords 1 </Model::DB::Users> SEE ALSO
Catalyst::Model::DBIC::Schema, DBIx::Class::Schema AUTHOR
See "AUTHOR" in Catalyst::Model::DBIC::Schema and "CONTRIBUTORS" in Catalyst::Model::DBIC::Schema. COPYRIGHT
See "COPYRIGHT" in Catalyst::Model::DBIC::Schema. LICENSE
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-06-12 Catalyst::TraitFor::Model::DBIC::Schema::SchemaProxy(3pm)

Featured Tech Videos