New format of changelog (easier to read)
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / ResultSourceProxy.pm
CommitLineData
75d07914 1package # hide from PAUSE
c0e7b4e5 2 DBIx::Class::ResultSourceProxy;
b98e75f6 3
4use strict;
5use warnings;
6
7use base qw/DBIx::Class/;
93405cf0 8use Scalar::Util qw/blessed/;
9use Carp::Clan qw/^DBIx::Class/;
b98e75f6 10
5ac6a044 11sub iterator_class { shift->result_source_instance->resultset_class(@_) }
b98e75f6 12sub resultset_class { shift->result_source_instance->resultset_class(@_) }
831ad24f 13sub result_class { shift->result_source_instance->result_class(@_) }
a48e92d7 14sub source_info { shift->result_source_instance->source_info(@_) }
b98e75f6 15
93405cf0 16sub 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
24sub get_inherited_ro_instance {
25 return shift->get_inherited(@_);
26}
27
28__PACKAGE__->mk_group_accessors('inherited_ro_instance' => 'source_name');
29
30
5ac6a044 31sub resultset_attributes {
32 shift->result_source_instance->resultset_attributes(@_);
33}
34
b98e75f6 35sub 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) {
157ce0cf 40 # If this is an augment definition get the real colname.
41 $c =~ s/^\+//;
42
1f23a877 43 $class->register_column($c => $source->column_info($c));
44 }
b98e75f6 45}
46
f871c774 47sub add_column {
48 shift->add_columns(@_);
49}
002a359a 50
75d07914 51sub has_column {
bfeb73b2 52 shift->result_source_instance->has_column(@_);
b98e75f6 53}
54
75d07914 55sub column_info {
bfeb73b2 56 shift->result_source_instance->column_info(@_);
b98e75f6 57}
58
d9916234 59sub column_info_from_storage {
60 shift->result_source_instance->column_info_from_storage(@_);
6eda9bcf 61}
002a359a 62
75d07914 63sub columns {
bfeb73b2 64 shift->result_source_instance->columns(@_);
75d07914 65}
002a359a 66
67sub remove_columns {
bfeb73b2 68 shift->result_source_instance->remove_columns(@_);
002a359a 69}
70
71*remove_column = \&remove_columns;
72
bc0c9800 73sub set_primary_key {
74 shift->result_source_instance->set_primary_key(@_);
75}
76
77sub primary_columns {
78 shift->result_source_instance->primary_columns(@_);
79}
b98e75f6 80
a83cdbf2 81sub _pri_cols {
82 shift->result_source_instance->_pri_cols(@_);
83}
84
bc0c9800 85sub add_unique_constraint {
86 shift->result_source_instance->add_unique_constraint(@_);
87}
88
89sub unique_constraints {
90 shift->result_source_instance->unique_constraints(@_);
91}
87f0da6a 92
1bc0b925 93sub unique_constraint_names {
94 shift->result_source_instance->unique_constraint_names(@_);
95}
96
97sub unique_constraint_columns {
98 shift->result_source_instance->unique_constraint_columns(@_);
99}
100
8c49f629 101sub add_relationship {
71e65b39 102 my ($class, $rel, @rest) = @_;
103 my $source = $class->result_source_instance;
104 $source->add_relationship($rel => @rest);
105 $class->register_relationship($rel => $source->relationship_info($rel));
8c49f629 106}
107
108sub relationships {
109 shift->result_source_instance->relationships(@_);
110}
111
112sub relationship_info {
113 shift->result_source_instance->relationship_info(@_);
114}
115
0818c9a7 116sub has_relationship {
117 shift->result_source_instance->has_relationship(@_);
118}
b98e75f6 1191;