sub resultset {
my $self = shift;
+ $self->throw_exception('resultset does not take any arguments. If you want another resultset, call it on the schema instead.') if scalar @_;
return $self->{_resultset} if ref $self->{_resultset} eq $self->resultset_class;
return $self->{_resultset} = do {
my $rs = $self->resultset_class->new($self, $self->{resultset_attributes});
my $ident_cond = $self->ident_condition;
$self->throw_exception("Cannot safely delete a row in a PK-less table")
if ! keys %$ident_cond;
+ foreach my $column (keys %$ident_cond) {
+ $self->throw_exception("Can't delete the object unless it has loaded the primary keys")
+ unless exists $self->{_column_data}{$column};
+ }
$self->result_source->storage->delete(
$self->result_source->from, $ident_cond);
$self->in_storage(undef);