https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25296 Bug ID: 25296 Summary: Add a way to force an empty Koha::Objects resultset Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org In some scenarios, it would be handy for consistency to just return an empty resultset (instead of undef, for example). Take the following example: sub current_item_level_holds { my ($self) = @_; my $items_rs = $self->_result->aqorders_items; my @item_numbers = $items_rs->get_column('itemnumber')->all; return unless @item_numbers; my $biblio = $self->biblio; return unless $biblio; return $biblio->current_holds->search( { itemnumber => { -in => \@item_numbers } } ); } if we wanted to always return a Koha::Holds iterator (as ->current_holds does) we could do: sub current_item_level_holds { my ($self) = @_; my $items_rs = $self->_result->aqorders_items; my @item_numbers = $items_rs->get_column('itemnumber')->all; my $biblio = $self->biblio; unless ( $biblio and @itemnumbers ) { return Koha::Holds->new->empty; } return $biblio->current_holds->search( { itemnumber => { -in => \@item_numbers } } ); } -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.