[Koha-bugs] [Bug 13719] Make Koha::Objects store list of resultant objects on an as needed basis

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Feb 19 12:21:34 CET 2015


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13719

Kyle M Hall <kyle at bywatersolutions.com> changed:

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

--- Comment #5 from Kyle M Hall <kyle at bywatersolutions.com> ---
Created attachment 36022
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=36022&action=edit
Bug 13719 - Make Koha::Objects store list of resultant objects on an as needed
basis

We can both simplify and improve the functioning of Koha::Objects by
removing out reliance on DBIC for set iteration ( first(), next(),
reset(), etc ). The problem is that DBIC destroys and refetches
results every time reset() is called. For example, take the following
code:

my $borrowers = Koha::Borrowers->search({ firstname => 'Kyle' }).
my $kyle1 = $borrowers->next();
$borrowers->reset();
my $kyle2 = $borrowers->next();

In this case, we would expect $kyle1 and $kyle2 to refer to the exact
same object in memory, but they do *not*. This is simply a limitation of
DBIx::Class.

However, by handling this issue ourselves, we not only solve the
problem, but I believe we also reduce the complexity of our code.

This is all accomplished without changing the external behavior of the
Koha::Objects module.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Borrowers.t

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


More information about the Koha-bugs mailing list