Producer::Turnkey obsolete. now rely on TTSchema parser (see concommitant
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Schema / Graph / Edge.pm
1 package SQL::Translator::Schema::Graph::Edge;
2
3 use strict;
4
5 use Class::MakeMethods::Template::Hash (
6   new => ['new'],
7   scalar => [ qw( type ) ],
8   array => [ qw( traversals ) ],
9   object => [
10                          'thisfield'    => {class => 'SQL::Translator::Schema::Field'}, #FIXME
11                          'thatfield'    => {class => 'SQL::Translator::Schema::Field'}, #FIXME
12                          'thisnode'     => {class => 'SQL::Translator::Schema::Graph::Node'},
13                          'thatnode'     => {class => 'SQL::Translator::Schema::Graph::Node'},
14
15                         ],
16 );
17
18 sub flip {
19   my $self = shift;
20
21 #warn "self thisfield: ".$self->thisfield->name;
22 #warn "self thatfield: ".$self->thatfield->name;
23
24   return SQL::Translator::Schema::Graph::Edge->new( thisfield => $self->thatfield,
25                                                                                                         thatfield => $self->thisfield,
26                                                                                                         thisnode  => $self->thatnode,
27                                                                                                         thatnode  => $self->thisnode,
28                                                                                                         type => $self->type eq 'import' ? 'export' : 'import'
29                                                                                                   );
30 }
31
32 1;