bugfixes in Class::DBI method generation. they were caused by bad schema
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Schema / Graph / Node.pm
1 package SQL::Translator::Schema::Graph::Node;
2
3 use strict;
4
5 use Class::MakeMethods::Template::Hash (
6   new => [ 'new' ],
7   'array_of_objects -class SQL::Translator::Schema::Graph::Edge' => [ qw( edges ) ],
8   'array_of_objects -class SQL::Translator::Schema::Graph::CompoundEdge' => [ qw( compoundedges ) ],
9   'array_of_objects -class SQL::Translator::Schema::Graph::HyperEdge' => [ qw( hyperedges ) ],
10   #'hash' => [ qw( many via has edgecount data_fields) ],
11   'hash' => [ qw( many via has data_fields) ],
12   scalar => [ qw( base name order primary_key primary_key_accessor table is_trivial_link ) ],
13   number => [ qw( order ) ],
14 );
15
16 sub edgecount {
17   my($self) = shift;
18
19   $self->{_edgecount} ||= {};
20
21   if(scalar(@_) == 1){
22     my $k = shift;
23     return $self->{_edgecount}{$k};
24   } elsif(@_) {
25     my %arg = @_;
26
27     foreach my $k (keys %arg){
28       #warn $a,"\t",$arg{$k};
29       $self->{_edgecount}{$k} = $arg{$k};
30     }
31
32     return %arg;
33   } else {
34     return $self->{_edgecount};
35   }
36 }
37
38 1;