Bugzilla – Attachment 123993 Details for
Bug 28883
Koha::Objects->_new_from_dbic doesn't work correctly in list context
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28883: Make Koha::Objects->_new_from_dbic honour list context
Bug-28883-Make-KohaObjects-newfromdbic-honour-list.patch (text/plain), 1.64 KB, created by
Marcel de Rooy
on 2021-08-20 08:48:18 UTC
(
hide
)
Description:
Bug 28883: Make Koha::Objects->_new_from_dbic honour list context
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2021-08-20 08:48:18 UTC
Size:
1.64 KB
patch
obsolete
>From be04f327036af784308caf580ade40c911b4c553 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 19 Aug 2021 11:39:13 -0300 >Subject: [PATCH] Bug 28883: Make Koha::Objects->_new_from_dbic honour list > context >Content-Type: text/plain; charset=utf-8 > >This patch makes the _new_from_dbic method return a list in list >context. It does so by leveraging on the existing Koha::Objects->_wrap >internal method that _does the right thing_. > >To test: >1. Apply the regression tests patch >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Objects.t >=> FAIL: Boo! Tests fail! The list is not empty, and it contains... a > resultset intead of empty or individual items. >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! Things work as expected! >5. Run: > k$ probe t/db_dependent/Koha/Biblio.t >=> SUCCESS: Tests pass! It uses the chaining: > $biblio->items->as_list > and doesn't break. It implies that the change won't break any Koha > place in which ->as_list is being used on a resultset created by > _new_from_dbic >6. Sign off :-D > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Objects.pm | 5 +++++ > 1 file changed, 5 insertions(+) > >diff --git a/Koha/Objects.pm b/Koha/Objects.pm >index 3ee0a55742..86de594469 100644 >--- a/Koha/Objects.pm >+++ b/Koha/Objects.pm >@@ -67,6 +67,11 @@ my $object = Koha::Objects->_new_from_dbic( $resultset ); > > sub _new_from_dbic { > my ( $class, $resultset ) = @_; >+ >+ if ( wantarray ) { >+ return $class->_wrap( $resultset->all() ); >+ } >+ > my $self = { _resultset => $resultset }; > > bless( $self, $class ); >-- >2.20.1
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 28883
:
123976
|
123977
|
123980
|
123981
|
123992
| 123993 |
123994
|
123995
|
124181
|
124420