[Koha-bugs] [Bug 28883] Koha::Objects->_new_from_dbic doesn't work correctly in list context

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Aug 20 10:48:18 CEST 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28883

Marcel de Rooy <m.de.rooy at rijksmuseum.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #123981|0                           |1
        is obsolete|                            |

--- Comment #9 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
Created attachment 123993
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=123993&action=edit
Bug 28883: Make Koha::Objects->_new_from_dbic honour list context

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 at davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy at rijksmuseum.nl>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list