sub add_columns {
my ($class, @cols) = @_;
- $class->result_source->add_columns(map lc, @cols);
+ $class->result_source_instance->add_columns(map lc, @cols);
$class->_mk_column_accessors(@cols);
}
$class->_column_groups($groups);
}
-sub all_columns { return shift->result_source->columns; }
+sub all_columns { return shift->result_source_instance->columns; }
sub primary_column {
my ($class) = @_;
$self->throw( "No relationship to JOIN from ${from_class} to ${to_class}" )
unless $rel_obj;
my $join = $from_class->storage->sql_maker->_join_condition(
- $from_class->result_source->resolve_condition(
+ $from_class->result_source_instance->resolve_condition(
$rel_obj->{cond}, $to, $from) );
return $join;
}
my ($class, $sth) = @_;
my @ret;
while (my $row = $sth->fetchrow_hashref) {
- push(@ret, $class->inflate_result($class->result_source, $row));
+ push(@ret, $class->inflate_result($class->result_source_instance, $row));
}
return @ret;
}
sub resultset_instance {
my $class = shift;
- my $source = $class->result_source;
+ my $source = $class->result_source_instance;
if ($source->result_class ne $class) {
$source = $source->new($source);
$source->result_class($class);
=cut
-sub add_relationship {
- shift->result_source->add_relationship(@_);
-}
-
-sub relationships {
- shift->result_source->relationships(@_);
-}
-
-sub relationship_info {
- shift->result_source->relationship_info(@_);
-}
-
=head2 search_related
My::Table->search_related('relname', $cond, $attrs);
sub set_primary_key { shift->result_source_instance->set_primary_key(@_); }
sub primary_columns { shift->result_source_instance->primary_columns(@_); }
+sub add_relationship {
+ shift->result_source_instance->add_relationship(@_);
+}
+
+sub relationships {
+ shift->result_source_instance->relationships(@_);
+}
+
+sub relationship_info {
+ shift->result_source_instance->relationship_info(@_);
+}
+
sub result_source { shift->result_source_instance(@_); }
1;
use base qw/DBIx::Class/;
+#__PACKAGE__->mk_group_accessors('simple' => 'result_source');
+
=head1 NAME
DBIx::Class::Row - Basic row methods
my %reg = %{$self->class_registrations};
$reg{$name} = $to_register;
$self->class_registrations(\%reg);
- $to_register->result_source->schema($self);
+ $to_register->result_source_instance->schema($self);
}
=head2 registered_classes
sub source {
my ($self, $class) = @_;
- return $self->class_registrations->{$class}->result_source
+ return $self->class_registrations->{$class}->result_source_instance
if $self->class_registrations->{$class};
}
sub resultset {
my ($self, $class) = @_;
- return $self->class_registrations->{$class}->result_source->resultset;
+ return $self->class_registrations->{$class}->result_source_instance->resultset;
}
my $schema = $self->compose_namespace($target, $conn_class);
$schema->storage($conn_class->storage);
foreach my $class ($schema->registered_classes) {
- my $source = $class->result_source;
+ my $source = $class->result_source_instance;
$source = $source->new($source);
$source->schema($schema);
$source->result_class($class);
- $class->mk_classdata(result_source => $source);
+ $class->mk_classdata(result_source_instance => $source);
$class->mk_classdata(resultset_instance => $source->resultset);
}
return $schema;
$new->insert_or_update;
is( $schema->resultset("Track")->find(100)->position, 5, 'insert_or_update update ok');
-eval { $schema->resultset("Track")->load_components('DoesNotExist'); };
+eval { $schema->class("Track")->load_components('DoesNotExist'); };
ok $@, $@;