remove_columns now deletes columns from _columns fixing has_columns false positives
[dbsrgits/DBIx-Class-Historic.git] / lib / DBIx / Class / ResultSourceProxy.pm
1 package # hide from PAUSE
2     DBIx::Class::ResultSourceProxy;
3
4 use strict;
5 use warnings;
6
7 use base qw/DBIx::Class/;
8
9 sub iterator_class  { shift->result_source_instance->resultset_class(@_) }
10 sub resultset_class { shift->result_source_instance->resultset_class(@_) }
11 sub result_class { shift->result_source_instance->result_class(@_) }
12 sub source_name { shift->result_source_instance->source_name(@_) }
13
14 sub resultset_attributes {
15   shift->result_source_instance->resultset_attributes(@_);
16 }
17
18 sub add_columns {
19   my ($class, @cols) = @_;
20   my $source = $class->result_source_instance;
21   $source->add_columns(@cols);
22   foreach my $c (grep { !ref } @cols) {
23     $class->register_column($c => $source->column_info($c));
24   }
25 }
26
27 *add_column = \&add_columns;
28
29 sub has_column {
30   shift->result_source_instance->has_column(@_);
31 }
32
33 sub column_info {
34   shift->result_source_instance->column_info(@_);
35 }
36
37 sub columns {
38   shift->result_source_instance->columns(@_);
39 }
40
41 sub remove_columns {
42   shift->result_source_instance->remove_columns(@_);
43 }
44
45 *remove_column = \&remove_columns;
46
47 sub set_primary_key {
48   shift->result_source_instance->set_primary_key(@_);
49 }
50
51 sub primary_columns {
52   shift->result_source_instance->primary_columns(@_);
53 }
54
55 sub add_unique_constraint {
56   shift->result_source_instance->add_unique_constraint(@_);
57 }
58
59 sub unique_constraints {
60   shift->result_source_instance->unique_constraints(@_);
61 }
62
63 sub unique_constraint_names {
64   shift->result_source_instance->unique_constraint_names(@_);
65 }
66
67 sub unique_constraint_columns {
68   shift->result_source_instance->unique_constraint_columns(@_);
69 }
70
71 sub add_relationship {
72   my ($class, $rel, @rest) = @_;
73   my $source = $class->result_source_instance;
74   $source->add_relationship($rel => @rest);
75   $class->register_relationship($rel => $source->relationship_info($rel));
76 }
77
78 sub relationships {
79   shift->result_source_instance->relationships(@_);
80 }
81
82 sub relationship_info {
83   shift->result_source_instance->relationship_info(@_);
84 }
85
86 1;