From 3bd03753e22635304bc6ffe385fc60b5229d8c6e Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 12 Jan 2011 16:04:07 +0100 Subject: [PATCH] Keine lokalen Variablennamen doppelt vergeben --- SL/DB/Helper/LinkedRecords.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/SL/DB/Helper/LinkedRecords.pm b/SL/DB/Helper/LinkedRecords.pm index 8784811a7..1f91718bc 100644 --- a/SL/DB/Helper/LinkedRecords.pm +++ b/SL/DB/Helper/LinkedRecords.pm @@ -75,14 +75,14 @@ sub link_to_record { my @links; foreach my $direction (@directions) { - my %params = ( $direction->[0] . "_table" => SL::DB::Helper::Mappings::get_table_for_package(ref($self)), - $direction->[0] . "_id" => $self->id, - $direction->[1] . "_table" => SL::DB::Helper::Mappings::get_table_for_package(ref($other)), - $direction->[1] . "_id" => $other->id, - ); - - my $link = SL::DB::Manager::RecordLink->find_by(and => [ %params ]); - push @links, $link ? $link : SL::DB::RecordLink->new(%params)->save unless $link; + my %data = ( $direction->[0] . "_table" => SL::DB::Helper::Mappings::get_table_for_package(ref($self)), + $direction->[0] . "_id" => $self->id, + $direction->[1] . "_table" => SL::DB::Helper::Mappings::get_table_for_package(ref($other)), + $direction->[1] . "_id" => $other->id, + ); + + my $link = SL::DB::Manager::RecordLink->find_by(and => [ %data ]); + push @links, $link ? $link : SL::DB::RecordLink->new(%data)->save unless $link; } return wantarray ? @links : $links[0]; -- 2.20.1