Bug 20287: Koha::Object->get_from_storage

May be part of a separate bug report if needed

TODO - add POD + tests

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2018-02-22 11:19:50 -03:00 committed by Nick Clemens
parent a6059c4d2d
commit 1144ee4b81
2 changed files with 14 additions and 0 deletions

View File

@ -219,6 +219,17 @@ sub unblessed {
return { $self->_result->get_columns };
}
=head3 $object->get_from_storage;
=cut
sub get_from_storage {
my ( $self, $attrs ) = @_;
my $stored_object = $self->_result->get_from_storage($attrs);
my $object_class = Koha::Object::_get_object_class( $self->_result->result_class );
return $object_class->_new_from_dbic($stored_object);
}
=head3 $object->TO_JSON
Returns an unblessed representation of the object, suitable for JSON output.

View File

@ -1433,5 +1433,8 @@ __PACKAGE__->add_columns(
sub koha_objects_class {
'Koha::Patrons';
}
sub koha_object_class {
'Koha::Patron';
}
1;