Start setting the 'c3' mro unambiguously everywhere
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / CDBICompat / ColumnCase.pm
CommitLineData
c0e7b4e5 1package # hide from PAUSE
2 DBIx::Class::CDBICompat::ColumnCase;
ea2e61bf 3
4use strict;
5use warnings;
75a23b3e 6
ea2e61bf 7sub _register_column_group {
8 my ($class, $group, @cols) = @_;
147dd158 9 return $class->next::method($group => map lc, @cols);
ea2e61bf 10}
11
ec77fadc 12sub add_columns {
13 my ($class, @cols) = @_;
c0eb27e8 14 return $class->result_source_instance->add_columns(map lc, @cols);
ec77fadc 15}
16
12bbb339 17sub has_a {
c79bd6e9 18 my($self, $col, @rest) = @_;
d4daee7b 19
c79bd6e9 20 $self->_declare_has_a(lc $col, @rest);
21 $self->_mk_inflated_column_accessor($col);
d4daee7b 22
c79bd6e9 23 return 1;
12bbb339 24}
25
b8e1e21f 26sub has_many {
27 my ($class, $rel, $f_class, $f_key, @rest) = @_;
de0ed7f1 28 return $class->next::method(
29 $rel,
30 $f_class,
31 (ref($f_key) ?
32 $f_key :
33 lc($f_key||'')
34 ),
35 @rest
36 );
b8e1e21f 37}
38
9f300b1b 39sub get_inflated_column {
12bbb339 40 my ($class, $get, @rest) = @_;
147dd158 41 return $class->next::method(lc($get), @rest);
12bbb339 42}
43
9f300b1b 44sub store_inflated_column {
12bbb339 45 my ($class, $set, @rest) = @_;
147dd158 46 return $class->next::method(lc($set), @rest);
12bbb339 47}
48
9f300b1b 49sub set_inflated_column {
12bbb339 50 my ($class, $set, @rest) = @_;
147dd158 51 return $class->next::method(lc($set), @rest);
ea2e61bf 52}
53
510ca912 54sub get_column {
ea2e61bf 55 my ($class, $get, @rest) = @_;
147dd158 56 return $class->next::method(lc($get), @rest);
ea2e61bf 57}
58
510ca912 59sub set_column {
ea2e61bf 60 my ($class, $set, @rest) = @_;
147dd158 61 return $class->next::method(lc($set), @rest);
510ca912 62}
63
64sub store_column {
65 my ($class, $set, @rest) = @_;
147dd158 66 return $class->next::method(lc($set), @rest);
ea2e61bf 67}
68
69sub find_column {
70 my ($class, $col) = @_;
147dd158 71 return $class->next::method(lc($col));
ea2e61bf 72}
73
9387c904 74# _build_query
75#
76# Build a query hash for find, et al. Overrides Retrieve::_build_query.
77
78sub _build_query {
79 my ($self, $query) = @_;
80
81 my %new_query;
82 $new_query{lc $_} = $query->{$_} for keys %$query;
83
84 return \%new_query;
85}
86
8da46543 87sub _deploy_accessor {
88 my($class, $name, $accessor) = @_;
e60dc79f 89
8da46543 90 return if $class->_has_custom_accessor($name);
e60dc79f 91
8da46543 92 $class->next::method(lc $name => $accessor);
93 return $class->next::method($name => $accessor);
12bbb339 94}
95
8da46543 96
12bbb339 97sub new {
98 my ($class, $attrs, @rest) = @_;
99 my %att;
100 $att{lc $_} = $attrs->{$_} for keys %$attrs;
147dd158 101 return $class->next::method(\%att, @rest);
ea2e61bf 102}
103
1041;