1 package # hide from PAUSE
2 DBIx::Class::ResultSourceProxy;
7 use base qw/DBIx::Class/;
8 use Scalar::Util qw/blessed/;
9 use Sub::Name qw/subname/;
12 __PACKAGE__->mk_group_accessors('inherited_ro_instance' => 'source_name');
14 sub get_inherited_ro_instance { shift->get_inherited(@_) }
16 sub set_inherited_ro_instance {
19 $self->throw_exception ("Cannot set @{[shift]} on an instance")
22 $self->set_inherited(@_);
27 my ($class, @cols) = @_;
28 my $source = $class->result_source_instance;
29 $source->add_columns(@cols);
30 foreach my $c (grep { !ref } @cols) {
31 # If this is an augment definition get the real colname.
34 $class->register_column($c => $source->column_info($c));
38 sub add_column { shift->add_columns(@_) }
41 sub add_relationship {
42 my ($class, $rel, @rest) = @_;
43 my $source = $class->result_source_instance;
44 $source->add_relationship($rel => @rest);
45 $class->register_relationship($rel => $source->relationship_info($rel));
49 # legacy resultset_class accessor, seems to be used by cdbi only
50 sub iterator_class { shift->result_source_instance->resultset_class(@_) }
52 for my $method_to_proxy (qw/
66 column_info_from_storage
73 add_unique_constraints
76 unique_constraint_names
77 unique_constraint_columns
84 *{__PACKAGE__."::$method_to_proxy"} = subname $method_to_proxy => sub {
85 shift->result_source_instance->$method_to_proxy (@_);