diff --git a/Koha/Object.pm b/Koha/Object.pm index e35ff0b85e..e62af3eb11 100644 --- a/Koha/Object.pm +++ b/Koha/Object.pm @@ -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. diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index 8663b8654b..3381116ead 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -1433,5 +1433,8 @@ __PACKAGE__->add_columns( sub koha_objects_class { 'Koha::Patrons'; } +sub koha_object_class { + 'Koha::Patron'; +} 1;