[Koha-bugs] [Bug 23185] Koha::Objects supports passing through 'update' which means we can side step 'set' + 'store'

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu May 7 23:30:16 CEST 2020


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

--- Comment #38 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
Created attachment 104537
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=104537&action=edit
Bug 23185: ->update can only be called on instantiated classes

Since our use ok Koha::Objects, there's been an implicit instantiation
happening in ->search that has somehow hidden the fact that classes need
instantiation...

This change in ->delete and ->update made it clear because of the
failures/hangs on the tests.

This patch instantiates Koha::Patron::Categories before attempting to
call ->update.

The original patches for this bug are correct and the only issue here is
that we need to document better than for some methods, instantiation is
not implicit and is required first. This is awkward and I would prefer
to force everyone to call ->new first. But I understand it would be
inconvenient.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Template/Plugin/Categories.t
=> FAIL: Notice it hangs, Ctrl+c to abort
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests dong hang, and in fact pass
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen at theke.io>

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list