Bugzilla – Attachment 169133 Details for
Bug 37389
REST API queries joining on extended_attributes may cause severe performance issues
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37389: Add AUTOLOAD to dynamically add relation accessors
Bug-37389-Add-AUTOLOAD-to-dynamically-add-relation.patch (text/plain), 1.43 KB, created by
Martin Renvoize
on 2024-07-18 13:14:34 UTC
(
hide
)
Description:
Bug 37389: Add AUTOLOAD to dynamically add relation accessors
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2024-07-18 13:14:34 UTC
Size:
1.43 KB
patch
obsolete
>From be855a146839cac4aa2f8bbb48b1e0c705489a72 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 18 Jul 2024 14:11:06 +0100 >Subject: [PATCH] Bug 37389: Add AUTOLOAD to dynamically add relation accessors > >This patch adds an AUTOLOAD to Koha::ILL::Request to allows fetching >extended_attributes_$type attributes via dynamically added relations >added into the underlying DBIC resultset class. >--- > Koha/ILL/Request.pm | 29 +++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) > >diff --git a/Koha/ILL/Request.pm b/Koha/ILL/Request.pm >index e7347e5ee32..24c3a2222f9 100644 >--- a/Koha/ILL/Request.pm >+++ b/Koha/ILL/Request.pm >@@ -2220,6 +2220,35 @@ sub get_staff_table_actions { > return $ill_table_actions; > } > >+=head3 AUTOLOAD >+ >+=cut >+ >+our $AUTOLOAD; >+ >+sub AUTOLOAD { >+ my ($self) = @_; >+ >+ my $name = $AUTOLOAD; >+ $name =~ s/.*:://; # Remove package name >+ >+ if ( $name =~ /^extended_attributes_(\w+)$/ ) { >+ my $type = $1; >+ >+ # Define the method dynamically >+ no strict 'refs'; >+ *{$AUTOLOAD} = sub { >+ my ($self) = @_; >+ my $relation = 'extended_attributes_' . $type; >+ my $rs = $self->_result->$relation; >+ return Koha::ILL::Request::Attributes->_new_from_dbic($rs)->search; >+ }; >+ >+ # Call the newly defined method >+ return $self->$name(); >+ } >+} >+ > =head3 _type > > =cut >-- >2.45.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37389
:
169130
|
169133
|
169140
|
169149
|
169159
|
169178
|
169185
|
169189
|
169191
|
169192
|
169234
|
169243
|
169244
|
169245
|
169246
|
169317
|
169318
|
169569
|
169570
|
169583
|
169584
|
169585
|
169586
|
169850
|
169851
|
169944
|
169945
|
169946
|
169954
|
169955
|
169956