Bug 24213: Fix Koha::Object->get_from_storage if the object has been deleted

Without this patch it fails with something like:
  DBIC result _type  isn't of the _type Subscription at t/db_dependent/Biblio.t line 627.

Test plan:
- Apply the first patch (Add tests)
- Confirm that they fail
- Apply this patch
- Confirm that the tests pass

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit a27c5c9dcd)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit f79f4dc5b1)

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
This commit is contained in:
Jonathan Druart 2019-12-11 09:39:30 +01:00 committed by Hayley Mapley
parent e11243cf04
commit 5eb60264e3
1 changed files with 1 additions and 0 deletions

View File

@ -263,6 +263,7 @@ sub unblessed {
sub get_from_storage {
my ( $self, $attrs ) = @_;
my $stored_object = $self->_result->get_from_storage($attrs);
return unless $stored_object;
my $object_class = Koha::Object::_get_object_class( $self->_result->result_class );
return $object_class->_new_from_dbic($stored_object);
}