From 4dd95b9ca930a119c3a1c2de1d96e1b82b193fbb Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 20 Dec 2023 17:29:30 +0000 Subject: [PATCH] Bug 34324: Add relationship aliases --- Koha/Schema/Result/Ticket.pm | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Koha/Schema/Result/Ticket.pm b/Koha/Schema/Result/Ticket.pm index bf8ca34317c..384d7046c13 100644 --- a/Koha/Schema/Result/Ticket.pm +++ b/Koha/Schema/Result/Ticket.pm @@ -226,6 +226,37 @@ __PACKAGE__->has_many( # Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-12-20 14:44:11 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GDz6OIQippcVcKESfzNbDg +__PACKAGE__->has_many( + "additional_field_values", + "Koha::Schema::Result::AdditionalFieldValue", + sub { + my ($args) = @_; + + return { + "$args->{foreign_alias}.record_id" => { -ident => "$args->{self_alias}.id" }, + + "$args->{foreign_alias}.field_id" => + { -in => \'(SELECT id FROM additional_fields WHERE tablename="tickets")' }, + }; + }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +__PACKAGE__->has_many( + "extended_attributes", + "Koha::Schema::Result::AdditionalFieldValue", + sub { + my ($args) = @_; + + return { + "$args->{foreign_alias}.record_id" => { -ident => "$args->{self_alias}.id" }, + + "$args->{foreign_alias}.field_id" => + { -in => \'(SELECT id FROM additional_fields WHERE tablename="tickets")' }, + }; + }, + { cascade_copy => 0, cascade_delete => 0 }, +); # You can replace this text with custom code or comments, and it will be preserved on regeneration 1; -- 2.43.0