use File::Temp 'tempfile';
use namespace::clean;
-our $VERSION = '0.07033';
+our $VERSION = '0.07036';
__PACKAGE__->mk_group_ro_accessors('simple', qw/
schema
this hash of parameters (as a list:)
rel_name # the name of the relationship
+ rel_type # the type of the relationship: 'belongs_to', 'has_many' or 'might_have'
local_source # the DBIx::Class::ResultSource object for the source the rel is *from*
remote_source # the DBIx::Class::ResultSource object for the source the rel is *to*
local_table # a DBIx::Class::Schema::Loader::Table object for the table of the source the rel is from
my %p = @_;
say "the relationship name is: $p{rel_name}";
+ say "the relationship is a: $p{rel_type}";
say "the local class is: ", $p{local_source}->result_class;
say "the remote class is: ", $p{remote_source}->result_class;
say "the local table is: ", $p{local_table}->sql_name;
remote_class => name of the DBIC class we are related to,
remote_moniker => moniker of the DBIC class we are related to,
remote_columns => columns in the other table in the relationship,
+ # for type => "many_to_many" only:
+ link_class => name of the DBIC class for the link table
+ link_moniker => moniker of the DBIC class for the link table
+ link_rel_name => name of the relationship to the link table
}
DBICSL will try to use the value returned as the relationship name.
=cut
-# ensure that a peice of object data is a valid arrayref, creating
+# ensure that a piece of object data is a valid arrayref, creating
# an empty one or encapsulating whatever's there.
sub _ensure_arrayref {
my $self = shift;
foreach my $c (@classes) {
# components default to being under the DBIx::Class namespace unless they
- # are preceeded with a '+'
+ # are preceded with a '+'
if ( $key =~ m/component/ && $c !~ s/^\+// ) {
$c = 'DBIx::Class::' . $c;
}
foreach my $prefix (@INC) {
my $fullpath = File::Spec->catfile($prefix, $file);
return $fullpath if -f $fullpath
- # abs_path throws on Windows for nonexistant files
+ # abs_path throws on Windows for nonexistent files
and (try { Cwd::abs_path($fullpath) }) ne
((try { Cwd::abs_path(File::Spec->catfile($self->dump_directory, $file)) }) || '');
}
my $moniker_parts = [ @{ $self->moniker_parts } ];
- my $have_schema = 1 if any { $_ eq 'schema' } @{ $self->moniker_parts };
- my $have_database = 1 if any { $_ eq 'database' } @{ $self->moniker_parts };
+ my $have_schema = any { $_ eq 'schema' } @{ $self->moniker_parts };
+ my $have_database = any { $_ eq 'database' } @{ $self->moniker_parts };
unshift @$moniker_parts, 'schema' if $use_schema && !$have_schema;
unshift @$moniker_parts, 'database' if $use_database && !$have_database;
my $context = {
table_class => $table_class,
table_moniker => $table_moniker,
- table_name => $table,
+ table_name => $table, # bugwards compatibility, RT#84050
+ table => $table,
full_table_name => $table->dbic_name,
schema_class => $schema_class,
column_info => $info,