Commit 5dee1566 authored by Matthieu Muffato's avatar Matthieu Muffato Committed by ens-bwalts
Browse files

Don't attempt removing objects that haven't been stored

parent 284fb0aa
......@@ -416,6 +416,9 @@ sub remove { # remove the object by primary_key
my $self = shift @_;
my $object = shift @_;
# the object hasn't actually been stored yet / in this database
return if(UNIVERSAL::can($object, 'adaptor') and (!$object->adaptor or $object->adaptor != $self));
my $primary_key_constraint = $self->primary_key_constraint( $self->slicer($object, $self->primary_key()) );
return $self->remove_all( $primary_key_constraint );
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment