[Koha-bugs] [Bug 13719] Store list of objects as needed

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


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

--- Comment #4 from Kyle M Hall <kyle at bywatersolutions.com> ---
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