From cc481b622cf006d463e7cea5cb6f643f0d818701 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 22 Jul 2021 10:57:17 +0100 Subject: [PATCH] Bug 22690: (QA follow-up) Use relationship accessor With the addition of foreign key relationships to the linktracker table we now get a DBIC relationship accessor we can use. This clarifies the code slightly by using the _result->relationship form to get the DBIC resultset. We should still introduce a Koha::Object based class for this table at some point. --- Koha/Item.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index 3b3d9c9f35..b074d027fe 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -1256,9 +1256,7 @@ sub move_to_biblio { ); # linktrackers (there's no Koha object set available yet) - # direct lookup as there's no foreign key relationship yet - my $schema = Koha::Database->new()->schema(); - my $linktrackers = $schema->resultset('Linktracker')->search({ itemnumber => $self->itemnumber }); + my $linktrackers = $self->_result->linktrackers; $linktrackers->update_all({ biblionumber => $to_biblionumber }); return $to_biblionumber; -- 2.20.1