View | Details | Raw Unified | Return to bug 19410
Collapse All | Expand All

(-)a/Koha/Objects.pm (-1 / +42 lines)
Lines 170-175 sub search_related { Link Here
170
    }
170
    }
171
}
171
}
172
172
173
=head3 search_for_api
174
175
    my @objects = Koha::Objects->earch_for_api( $c );
176
177
Searches for objects given a controller object I<$c>.
178
179
=cut
180
181
sub search_for_api {
182
    my ( $self, $c ) = @_;
183
184
    my $args = $c->validation->output;
185
    my $attributes;
186
187
    # Extract reserved params
188
    my ( $filtered_params, $reserved_params ) = $c->extract_reserved_params($args);
189
190
    # Merge sorting into query attributes
191
    $c->dbic_merge_sorting(
192
        {
193
            attributes => $attributes,
194
            params     => $reserved_params
195
        }
196
    );
197
198
    # Merge pagination into query attributes
199
    $c->dbic_merge_pagination(
200
        {
201
            attributes => $attributes,
202
            params     => $reserved_params
203
        }
204
    );
205
206
    # Perform search
207
    my $objects = $self->search( $filtered_params, $attributes );
208
    $c->add_pagination_headers({ total => $objects->count, params => $args })
209
        if $objects->is_paged;
210
211
    return $objects;
212
}
213
214
173
=head3 single
215
=head3 single
174
216
175
my $object = Koha::Objects->search({}, { rows => 1 })->single
217
my $object = Koha::Objects->search({}, { rows => 1 })->single
176
- 

Return to bug 19410