Bugzilla – Attachment 123877 Details for
Bug 28871
Koha::Objects->empty doesn't work correctly in list context
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28871: Make Koha::Objects->empty work on list context
Bug-28871-Make-KohaObjects-empty-work-on-list-cont.patch (text/plain), 1.25 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-08-17 15:01:55 UTC
(
hide
)
Description:
Bug 28871: Make Koha::Objects->empty work on list context
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-08-17 15:01:55 UTC
Size:
1.25 KB
patch
obsolete
>From 3488e6ea4540a9c071b5055a8ee6bb32f6dbf8f9 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 17 Aug 2021 11:37:28 -0300 >Subject: [PATCH] Bug 28871: Make Koha::Objects->empty work on list context > >This patch makes Koha::Objects->empty work on list context, by making it >return the $self->search call. > >To test: >1. Apply the regression test patch >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Objects.t >=> FAIL: Tests fail! >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! >5. Sign off :-D > >Note: this patch has the side effect of making Koha::Objects->new->empty >to perform a search on the DB. I'm not sure how to solve this because >the cache needs to be set after the resultset is generated. It feels >like a cleaner approach (i.e. not using the set_cache method). >--- > Koha/Objects.pm | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > >diff --git a/Koha/Objects.pm b/Koha/Objects.pm >index 3ee0a55742..1cd2ec0907 100644 >--- a/Koha/Objects.pm >+++ b/Koha/Objects.pm >@@ -380,10 +380,9 @@ sub empty { > class => $self > ) unless ref $self; > >- $self = $self->search(\'0 = 1'); > $self->_resultset()->set_cache([]); > >- return $self; >+ return $self->search(\'0 = 1'); > } > > =head3 Koha::Objects->reset(); >-- >2.30.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 28871
:
123876
|
123877
|
123878
|
123879
|
123925
|
123926
|
123987
|
123988