use DBIx::Class::Exception;
use Carp::Clan qw/^DBIx::Class/;
use Try::Tiny;
+use List::Util 'first';
+use namespace::clean;
use base qw/DBIx::Class/;
If a column name beginning with a plus sign ('+col1') is provided, the
attributes provided will be merged with any existing attributes for the
column, with the new attributes taking precedence in the case that an
-attribute already exists. Using this without a hashref
+attribute already exists. Using this without a hashref
(C<< $source->add_columns(qw/+col1 +col2/) >>) is legal, but useless --
it does the same thing it would do without the plus.
This contains the column type. It is automatically filled if you use the
L<SQL::Translator::Producer::DBIx::Class::File> producer, or the
-L<DBIx::Class::Schema::Loader> module.
+L<DBIx::Class::Schema::Loader> module.
Currently there is no standard set of values for the data_type. Use
whatever your database supports.
$self->{_columns_info_loaded}++;
my $info = {};
my $lc_info = {};
+
# try for the case of storage without table
- my $caught;
- try { $info = $self->storage->columns_info_for( $self->from ) }
- catch { $caught = 1 };
- unless ($caught) {
+ try {
+ $info = $self->storage->columns_info_for( $self->from );
for my $realcol ( keys %{$info} ) {
$lc_info->{lc $realcol} = $info->{$realcol};
}
%{ $info->{$col} || $lc_info->{lc $col} || {} }
};
}
- }
+ };
}
return $self->_columns->{$column};
}
my $schema = $source->schema();
-Returns the L<DBIx::Class::Schema> object that this result source
+Returns the L<DBIx::Class::Schema> object that this result source
belongs to.
=head2 storage
return $self;
- # XXX disabled. doesn't work properly currently. skip in tests.
+# XXX disabled. doesn't work properly currently. skip in tests.
my $f_source = $self->schema->source($f_source_name);
unless ($f_source) {
try { $self->_resolve_join($rel, 'me', {}, []) }
catch {
# If the resolve failed, back out and re-throw the error
- delete $rels{$rel}; #
+ delete $rels{$rel};
$self->_relationships(\%rels);
$self->throw_exception("Error creating relationship $rel: $_");
};
+
1;
}
-is_single => (
$rel_info->{attrs}{accessor}
&&
- List::Util::first { $rel_info->{attrs}{accessor} eq $_ } (qw/single filter/)
+ first { $rel_info->{attrs}{accessor} eq $_ } (qw/single filter/)
),
-alias => $as,
-relation_chain_depth => $seen->{-relation_chain_depth} || 0,
keys %{$rel_info->{cond}};
my @ord = (ref($rel_info->{attrs}{order_by}) eq 'ARRAY'
? @{$rel_info->{attrs}{order_by}}
-
+
: (defined $rel_info->{attrs}{order_by}
? ($rel_info->{attrs}{order_by})
: ()));
=head2 handle
-Obtain a new handle to this source. Returns an instance of a
+Obtain a new handle to this source. Returns an instance of a
L<DBIx::Class::ResultSourceHandle>.
=cut