__PACKAGE__->load_components(qw/AccessorGroup/);
__PACKAGE__->mk_group_accessors('simple' =>
- qw/_ordered_columns _columns _primaries _unique_constraints name resultset_class result_class schema from _relationships/);
+ qw/_ordered_columns _columns _primaries _unique_constraints name resultset_class resultset_attributes result_class schema from _relationships/);
=head1 NAME
$class = ref $class if ref $class;
my $new = bless({ %{$attrs || {}} }, $class);
$new->{resultset_class} ||= 'DBIx::Class::ResultSet';
+ $new->{resultset_attributes} = { %{$new->{resultset_attributes} || {}} };
$new->{_ordered_columns} = [ @{$new->{_ordered_columns}||[]}];
$new->{_columns} = { %{$new->{_columns}||{}} };
$new->{_relationships} = { %{$new->{_relationships}||{}} };
return $new;
}
+=head2 add_columns
+
+ $table->add_columns(qw/col1 col2 col3/);
+
+ $table->add_columns('col1' => \%col1_info, 'col2' => \%col2_info, ...);
+
+Adds columns to the result source. If supplied key => hashref pairs uses
+the hashref as the column_info for that column.
+
+=head2 add_column
+
+ $table->add_column('col' => \%info?);
+
+Convenience alias to add_columns
+
+=cut
+
sub add_columns {
my ($self, @cols) = @_;
$self->_ordered_columns( \@cols )
*add_column = \&add_columns;
-=head2 add_columns
-
- $table->add_columns(qw/col1 col2 col3/);
-
- $table->add_columns('col1' => \%col1_info, 'col2' => \%col2_info, ...);
-
-Adds columns to the result source. If supplied key => hashref pairs uses
-the hashref as the column_info for that column.
-
-=head2 add_column
-
- $table->add_column('col' => \%info?);
-
-Convenience alias to add_columns
-
-=cut
-
-sub resultset {
- my $self = shift;
- return $self->resultset_class->new($self);
-}
-
=head2 has_column
if ($obj->has_column($col)) { ... }
An arrayref containing a list of accessors in the foreign class to proxy in
the main class. If, for example, you do the following:
- __PACKAGE__->might_have(bar => 'Bar', undef, { proxy => qw[/ margle /] });
+ __PACKAGE__->might_have(bar => 'Bar', undef, { proxy => [ qw/margle/ ] });
Then, assuming Bar has an accessor named margle, you can do:
prefixed relative to the current source, in accordance with where they appear
in the supplied relationships. Examples:
- my $source = $schema->$resultset('Tag')->source;
+ my $source = $schema->resultset('Tag')->source;
@columns = $source->resolve_prefetch( { cd => 'artist' } );
# @columns =
return $self->schema->source($self->relationship_info($rel)->{source});
}
-1;
+=head2 resultset
+
+Returns a resultset for the given source created by calling
+
+$self->resultset_class->new($self, $self->resultset_attributes)
+
+=head2 resultset_class
+
+Simple accessor.
+
+=head2 resultset_attributes
+
+Simple accessor.
+
+=cut
+
+sub resultset {
+ my $self = shift;
+ return $self->resultset_class->new($self, $self->{resultset_attributes});
+}
+
+=cut
=head2 throw_exception