]> git.koha-community.org Git - koha.git/commit
Bug 17783: Add Koha::Objects->single
authorLari Taskula <lari.taskula@jns.fi>
Thu, 15 Dec 2016 17:28:38 +0000 (19:28 +0200)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 23 Dec 2016 12:01:56 +0000 (12:01 +0000)
commit1ad30e63ea5e1d574d7cf82e86948ef501920d64
tree3615093155cfbcb7af55dfaf39f97db594eef51a
parent5b35c8e038a49a4e998656c60ba08e88dd982498
Bug 17783: Add Koha::Objects->single

Returns one and only one object that is part of this set.
Returns undef if there are no objects found.

->single is faster than ->search->next

This is optimal as it will grab the first returned result without instantiating
a cursor.

It is useful for this Bug as we only want to select the top row of found issuing
rules.

To test:
1. Run t/db_dependent/Koha/Objects.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Koha/Objects.pm
t/db_dependent/Koha/Objects.t