Commit | Line | Data |
75d07914 |
1 | package # hide from PAUSE |
c0e7b4e5 |
2 | DBIx::Class::ResultSourceProxy; |
b98e75f6 |
3 | |
4 | use strict; |
5 | use warnings; |
6 | |
7 | use base qw/DBIx::Class/; |
93405cf0 |
8 | use Scalar::Util qw/blessed/; |
9 | use Carp::Clan qw/^DBIx::Class/; |
b98e75f6 |
10 | |
5ac6a044 |
11 | sub iterator_class { shift->result_source_instance->resultset_class(@_) } |
b98e75f6 |
12 | sub resultset_class { shift->result_source_instance->resultset_class(@_) } |
831ad24f |
13 | sub result_class { shift->result_source_instance->result_class(@_) } |
a48e92d7 |
14 | sub source_info { shift->result_source_instance->source_info(@_) } |
b98e75f6 |
15 | |
93405cf0 |
16 | sub set_inherited_ro_instance { |
17 | my $self = shift; |
18 | |
19 | croak "Cannot set @{[shift]} on an instance" if blessed $self; |
20 | |
21 | return $self->set_inherited(@_); |
22 | } |
23 | |
24 | sub get_inherited_ro_instance { |
25 | return shift->get_inherited(@_); |
26 | } |
27 | |
28 | __PACKAGE__->mk_group_accessors('inherited_ro_instance' => 'source_name'); |
29 | |
30 | |
5ac6a044 |
31 | sub resultset_attributes { |
32 | shift->result_source_instance->resultset_attributes(@_); |
33 | } |
34 | |
b98e75f6 |
35 | sub add_columns { |
36 | my ($class, @cols) = @_; |
1f23a877 |
37 | my $source = $class->result_source_instance; |
38 | $source->add_columns(@cols); |
39 | foreach my $c (grep { !ref } @cols) { |
40 | $class->register_column($c => $source->column_info($c)); |
41 | } |
b98e75f6 |
42 | } |
43 | |
f871c774 |
44 | sub add_column { |
45 | shift->add_columns(@_); |
46 | } |
002a359a |
47 | |
75d07914 |
48 | sub has_column { |
bfeb73b2 |
49 | shift->result_source_instance->has_column(@_); |
b98e75f6 |
50 | } |
51 | |
75d07914 |
52 | sub column_info { |
bfeb73b2 |
53 | shift->result_source_instance->column_info(@_); |
b98e75f6 |
54 | } |
55 | |
d9916234 |
56 | sub column_info_from_storage { |
57 | shift->result_source_instance->column_info_from_storage(@_); |
6eda9bcf |
58 | } |
002a359a |
59 | |
75d07914 |
60 | sub columns { |
bfeb73b2 |
61 | shift->result_source_instance->columns(@_); |
75d07914 |
62 | } |
002a359a |
63 | |
64 | sub remove_columns { |
bfeb73b2 |
65 | shift->result_source_instance->remove_columns(@_); |
002a359a |
66 | } |
67 | |
68 | *remove_column = \&remove_columns; |
69 | |
bc0c9800 |
70 | sub set_primary_key { |
71 | shift->result_source_instance->set_primary_key(@_); |
72 | } |
73 | |
74 | sub primary_columns { |
75 | shift->result_source_instance->primary_columns(@_); |
76 | } |
b98e75f6 |
77 | |
bc0c9800 |
78 | sub add_unique_constraint { |
79 | shift->result_source_instance->add_unique_constraint(@_); |
80 | } |
81 | |
82 | sub unique_constraints { |
83 | shift->result_source_instance->unique_constraints(@_); |
84 | } |
87f0da6a |
85 | |
1bc0b925 |
86 | sub unique_constraint_names { |
87 | shift->result_source_instance->unique_constraint_names(@_); |
88 | } |
89 | |
90 | sub unique_constraint_columns { |
91 | shift->result_source_instance->unique_constraint_columns(@_); |
92 | } |
93 | |
8c49f629 |
94 | sub add_relationship { |
71e65b39 |
95 | my ($class, $rel, @rest) = @_; |
96 | my $source = $class->result_source_instance; |
97 | $source->add_relationship($rel => @rest); |
98 | $class->register_relationship($rel => $source->relationship_info($rel)); |
8c49f629 |
99 | } |
100 | |
101 | sub relationships { |
102 | shift->result_source_instance->relationships(@_); |
103 | } |
104 | |
105 | sub relationship_info { |
106 | shift->result_source_instance->relationship_info(@_); |
107 | } |
108 | |
b98e75f6 |
109 | 1; |