Commit | Line | Data |
0caaf4c3 |
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 | return SQL::Translator::Schema::Graph::Edge->new( thisfield => $self->thatfield, |
21 | thatfield => $self->thisfield, |
22 | thisnode => $self->thatnode, |
23 | thatnode => $self->thisnode, |
24 | type => $self->type eq 'import' ? 'export' : 'import' |
25 | ); |
26 | } |
27 | |
28 | 1; |