From 2e5bfbc5a7681831faf19d64506a38ce3a597fa7 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. Signed-off-by: Jonathan Druart --- Koha/Item.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index fdc13a90b9..c8b0d1cc91 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -1255,9 +1255,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.39.5