From: Marcus Ramberg Date: Tue, 7 Mar 2006 21:31:56 +0000 (+0000) Subject: more error messages. X-Git-Tag: v0.06000~60^2~59 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e0f5629209ddf78103b335df13b71b2192dd2f34;p=dbsrgits%2FDBIx-Class.git more error messages. --- diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index 8b3863f..edeb5b2 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -621,6 +621,7 @@ Specify here any attributes you wish to pass to your specialised resultset. 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}); diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index 33c8d19..83502cf 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -132,6 +132,10 @@ sub delete { 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);