[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
Thu Sep 2 11:18:32 CEST 2021


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

Martin Renvoize <martin.renvoize at ptfs-europe.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Signed Off                  |Failed QA

--- Comment #28 from Martin Renvoize <martin.renvoize at ptfs-europe.com> ---
Hmm, the more I delve into this the more scary I find it actually.. :(

I'm coming to a similar conclusion to Jonathan, that we should always return
the object iterator and rely on as_list to get an array or arrayref when
required.  As I try to QA 24857 I keep running into new issues in TT where we'd
need to start calling the Scalar plugin to get back the object... I'm kinda
torn here..

DBIC does the magic wantarray handling and then adds an _rs version of methods
to force return of a scalar ignoring context.. we're doing the opposite here by
having 'as_list' which forces return of an array (or arrayref) but again doing
magic in the core return.

Perhaps we should keep this but replace our as_list function with _rs or
as_object or something along those lines?  We loose some magic because we
always have to re-add the relationships back in manually when we write out
objects.. so adding an _rs equivalent for every relationship accessor could be
a bit of a pain :(.

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


More information about the Koha-bugs mailing list