[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
Fri Dec 18 19:36:07 CET 2015
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13719
Bernardo Gonzalez Kriegel <bgkriegel at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #36022|0 |1
is obsolete| |
--- Comment #9 from Bernardo Gonzalez Kriegel <bgkriegel at gmail.com> ---
Created attachment 45862
-->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=45862&action=edit
[SIGNED-OFF] 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
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel at gmail.com>
Test pass, no errors
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list