X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRow.pm;h=16745b506edd346c7e3b447b438ef5fcdfbcfe62;hb=75d079145a507a0e5ff89b2676d383f4fd1a5511;hp=1bdcd589a1b1a62c501a784c493f4fa5313616d1;hpb=884559b13fe244d3e446d127e9fd21ea8d7c6eb3;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index 1bdcd58..16745b5 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -10,7 +10,7 @@ __PACKAGE__->load_components(qw/AccessorGroup/); __PACKAGE__->mk_group_accessors('simple' => 'result_source'); -=head1 NAME +=head1 NAME DBIx::Class::Row - Basic row methods @@ -40,7 +40,7 @@ sub new { unless ref($attrs) eq 'HASH'; while (my ($k, $v) = each %$attrs) { $new->throw_exception("No such column $k on $class") - unless $class->has_column($k); + unless $class->has_column($k); $new->store_column($k => $v); } } @@ -122,8 +122,8 @@ sub update { $obj->delete -Deletes the object from the database. The object is still perfectly usable, -but ->in_storage() will now return 0 and the object must re inserted using +Deletes the object from the database. The object is still perfectly usable, +but ->in_storage() will now return 0 and the object must re inserted using ->insert() before ->update() can be used on it. =cut @@ -136,8 +136,8 @@ sub delete { $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->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); @@ -280,9 +280,9 @@ Sets a column value without marking it as dirty. sub store_column { my ($self, $column, $value) = @_; - $self->throw_exception( "No such column '${column}'" ) + $self->throw_exception( "No such column '${column}'" ) unless exists $self->{_column_data}{$column} || $self->has_column($column); - $self->throw_exception( "set_column called for ${column} without value" ) + $self->throw_exception( "set_column called for ${column} without value" ) if @_ < 3; return $self->{_column_data}{$column} = $value; } @@ -312,7 +312,7 @@ sub inflate_result { if (ref($pre_val->[0]) eq 'ARRAY') { # multi my @pre_objects; foreach my $pre_rec (@$pre_val) { - unless ($pre_source->primary_columns == grep { exists $pre_rec->[0]{$_} + unless ($pre_source->primary_columns == grep { exists $pre_rec->[0]{$_} and defined $pre_rec->[0]{$_} } $pre_source->primary_columns) { next; } @@ -322,11 +322,11 @@ sub inflate_result { $new->related_resultset($pre)->set_cache(\@pre_objects); } elsif (defined $pre_val->[0]) { my $fetched; - unless ($pre_source->primary_columns == grep { exists $pre_val->[0]{$_} + unless ($pre_source->primary_columns == grep { exists $pre_val->[0]{$_} and !defined $pre_val->[0]{$_} } $pre_source->primary_columns) { $fetched = $pre_source->result_class->inflate_result( - $pre_source, @{$pre_val}); + $pre_source, @{$pre_val}); } my $accessor = $source->relationship_info($pre)->{attrs}{accessor}; $class->throw_exception("No accessor for prefetched $pre")