1 package # hide from PAUSE
2 DBIx::Class::ResultSourceProxy;
7 use base 'DBIx::Class';
9 use Scalar::Util 'blessed';
10 use DBIx::Class::_Util 'quote_sub';
13 __PACKAGE__->mk_group_accessors('inherited_ro_instance' => 'source_name');
15 sub get_inherited_ro_instance { shift->get_inherited(@_) }
17 sub set_inherited_ro_instance {
20 $self->throw_exception ("Cannot set @{[shift]} on an instance")
23 $self->set_inherited(@_);
28 my ($class, @cols) = @_;
29 my $source = $class->result_source_instance;
30 $source->add_columns(@cols);
31 foreach my $c (grep { !ref } @cols) {
32 # If this is an augment definition get the real colname.
35 $class->register_column($c => $source->column_info($c));
39 sub add_column { shift->add_columns(@_) }
42 sub add_relationship {
43 my ($class, $rel, @rest) = @_;
44 my $source = $class->result_source_instance;
45 $source->add_relationship($rel => @rest);
46 $class->register_relationship($rel => $source->relationship_info($rel));
50 # legacy resultset_class accessor, seems to be used by cdbi only
51 sub iterator_class { shift->result_source_instance->resultset_class(@_) }
53 for my $method_to_proxy (qw/
67 column_info_from_storage
74 add_unique_constraints
77 unique_constraint_names
78 unique_constraint_columns
84 quote_sub __PACKAGE__."::$method_to_proxy", sprintf( <<'EOC', $method_to_proxy );
85 DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_INDIRECT_CALLS and DBIx::Class::_Util::fail_on_internal_call;
86 shift->result_source_instance->%s (@_);