From: Matt S Trout Date: Tue, 16 Sep 2008 18:58:25 +0000 (+0000) Subject: fixup get_from_storage and delete to use original ident X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=728e60a34cad109fa1c69954b8f7c4c8fa0d15e1;p=dbsrgits%2FDBIx-Class-Historic.git fixup get_from_storage and delete to use original ident --- diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index 424d750..5bbabba 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -378,7 +378,7 @@ sub delete { my $self = shift; if (ref $self) { $self->throw_exception( "Not in database" ) unless $self->in_storage; - my $ident_cond = $self->ident_condition; + my $ident_cond = $self->{_orig_ident} || $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) { @@ -836,14 +836,13 @@ second argument to $resultset->search($cond, $attrs); sub get_from_storage { my $self = shift @_; my $attrs = shift @_; - my @primary_columns = map { $self->$_ } $self->primary_columns; my $resultset = $self->result_source->resultset; if(defined $attrs) { $resultset = $resultset->search(undef, $attrs); } - return $resultset->find(@primary_columns); + return $resultset->find($self->{_orig_ident} || $self->ident_condition); } =head2 throw_exception