Lines 44-49
for API rendering.
Link Here
|
44 |
sub register { |
44 |
sub register { |
45 |
my ( $self, $app ) = @_; |
45 |
my ( $self, $app ) = @_; |
46 |
|
46 |
|
|
|
47 |
$app->helper( |
48 |
'objects.find' => sub { |
49 |
my ( $c, $result_set, $id ) = @_; |
50 |
|
51 |
my $attributes = {}; |
52 |
|
53 |
# Look for embeds |
54 |
my $embed = $c->stash('koha.embed'); |
55 |
# Generate prefetches for embedded stuff |
56 |
$c->dbic_merge_prefetch( |
57 |
{ |
58 |
attributes => $attributes, |
59 |
result_set => $result_set |
60 |
} |
61 |
); |
62 |
|
63 |
my $object = $result_set->find( $id, $attributes ); |
64 |
|
65 |
return $object->to_api({ embed => $embed }); |
66 |
} |
67 |
); |
68 |
|
47 |
$app->helper( |
69 |
$app->helper( |
48 |
'objects.search' => sub { |
70 |
'objects.search' => sub { |
49 |
my ( $c, $result_set ) = @_; |
71 |
my ( $c, $result_set ) = @_; |
50 |
- |
|
|