DBIx::Class::Schema::Loader::RelBuilder 0.03007 review
DownloadDBIx::Class::Schema::Loader::RelBuilder is a Perl module that builds relationships for DBIx::Class::Schema::Loader. This class bui
|
|
DBIx::Class::Schema::Loader::RelBuilder is a Perl module that builds relationships for DBIx::Class::Schema::Loader.
This class builds relationships for DBIx::Class::Schema::Loader. This is module is not (yet) for external use.
METHODS
new
Arguments: schema_class (scalar), fk_info (hashref), inflect_plural, inflect_singular
$schema_class should be a schema class name, where the source classes have already been set up and registered. Column info, primary key, and unique constraints will be drawn from this schema for all of the existing source monikers.
The fk_info hashref's contents should take the form:
{
TableMoniker => [
{
local_columns => [ 'col2', 'col3' ],
remote_columns => [ 'col5', 'col7' ],
remote_moniker => 'AnotherTableMoniker',
},
# ...
],
AnotherTableMoniker => [
# ...
],
# ...
}
Options inflect_plural and inflect_singular are optional, and are better documented in DBIx::Class::Schema::Loader::Base.
generate_code
This method will return the generated relationships as a hashref per table moniker, containing an arrayref of code strings which can be "eval"-ed in the context of the source class, like:
{
'Some::Source::Class' => [
"belongs_to( col1 => 'AnotherTableMoniker' )",
"has_many( anothers => 'AnotherTableMoniker', 'col15' )",
],
'Another::Source::Class' => [
# ...
],
# ...
}
You might want to use this in building an on-disk source class file, by adding each string to the appropriate source class file, prefixed by __PACKAGE__->.
Requirements:
Perl
DBIx::Class::Schema::Loader::RelBuilder 0.03007 keywords