Move the code to create accessors out of ColumnCase and into ColumnGroups.
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / CDBICompat / Relationship.pm
CommitLineData
a9c8094b 1package
2 DBIx::Class::CDBICompat::Relationship;
3
4use strict;
5use warnings;
6
7
8=head1 NAME
9
10DBIx::Class::CDBICompat::Relationship
11
12=head1 DESCRIPTION
13
14Emulate the Class::DBI::Relationship object returned from C<meta_info()>.
15
16=cut
17
18my %method2key = (
19 name => 'type',
20 class => 'self_class',
21 accessor => 'accessor',
22 foreign_class => 'class',
1097f5e4 23 args => 'args',
a9c8094b 24);
25
26sub new {
27 my($class, $args) = @_;
28
29 return bless $args, $class;
30}
31
32for my $method (keys %method2key) {
33 my $key = $method2key{$method};
34 my $code = sub {
35 $_[0]->{$key};
36 };
37
38 no strict 'refs';
39 *{$method} = $code;
40}
41
a9c8094b 421;