1 package # hide from PAUSE
2 DBIx::Class::ResultSourceProxy;
7 use base 'DBIx::Class';
10 use Scalar::Util 'blessed';
11 use DBIx::Class::_Util qw( quote_sub fail_on_internal_call );
14 __PACKAGE__->mk_group_accessors('inherited_ro_instance' => 'source_name');
16 sub get_inherited_ro_instance { shift->get_inherited(@_) }
18 sub set_inherited_ro_instance {
21 $self->throw_exception ("Cannot set @{[shift]} on an instance")
24 $self->set_inherited(@_);
29 my ($class, @cols) = @_;
30 my $source = $class->result_source_instance;
31 $source->add_columns(@cols);
32 foreach my $c (grep { !ref } @cols) {
33 # If this is an augment definition get the real colname.
36 $class->register_column($c => $source->column_info($c));
41 DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_INDIRECT_CALLS and fail_on_internal_call;
42 shift->add_columns(@_)
46 sub add_relationship {
47 my ($class, $rel, @rest) = @_;
48 my $source = $class->result_source_instance;
49 $source->add_relationship($rel => @rest);
50 $class->register_relationship($rel => $source->relationship_info($rel));
54 # legacy resultset_class accessor, seems to be used by cdbi only
56 DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_INDIRECT_CALLS and fail_on_internal_call;
57 shift->result_source_instance->resultset_class(@_)
60 for my $method_to_proxy (qw/
74 column_info_from_storage
81 add_unique_constraints
84 unique_constraint_names
85 unique_constraint_columns
91 quote_sub __PACKAGE__."::$method_to_proxy", sprintf( <<'EOC', $method_to_proxy );
92 DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_INDIRECT_CALLS and DBIx::Class::_Util::fail_on_internal_call;
93 shift->result_source_instance->%s (@_);