X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRow.pm;h=06f850bf6d27c7ab1148285d1003ffd38ca9308c;hb=a6b68a60b376e918a6058f37cb1115ba3163a59b;hp=ceb38d571c438810d9f0b1356c6d55fa082a50d1;hpb=38d5ea9f06646beb01422d3d6a2994f1601bf35e;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index ceb38d5..06f850b 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -106,10 +106,10 @@ with NULL as the default, and save yourself a SELECT. sub __new_related_find_or_new_helper { my ($self, $relname, $data) = @_; + my $rsrc = $self->result_source; + # create a mock-object so all new/set_column component overrides will run: - my $rel_rs = $self->result_source - ->related_source($relname) - ->resultset; + my $rel_rs = $rsrc->related_source($relname)->resultset; my $new_rel_obj = $rel_rs->new_result($data); my $proc_data = { $new_rel_obj->get_columns }; @@ -117,7 +117,7 @@ sub __new_related_find_or_new_helper { MULTICREATE_DEBUG and warn "MC $self constructing $relname via new_result"; return $new_rel_obj; } - elsif ($self->result_source->_pk_depends_on($relname, $proc_data )) { + elsif ($rsrc->_pk_depends_on($relname, $proc_data )) { if (! keys %$proc_data) { # there is nothing to search for - blind create MULTICREATE_DEBUG and warn "MC $self constructing default-insert $relname"; @@ -132,7 +132,7 @@ sub __new_related_find_or_new_helper { return $new_rel_obj; } else { - my $us = $self->source_name; + my $us = $rsrc->source_name; $self->throw_exception ("'$us' neither depends nor is depended on by '$relname', something is wrong..."); } } @@ -363,8 +363,8 @@ sub insert { my $updated_cols = $source->storage->insert( $source, { $self->get_columns }, - (keys %auto_pri) && $source->storage->can_insert_returning - ? { returning => [ sort { $auto_pri{$a} cmp $auto_pri{$b} } keys %auto_pri ] } + (keys %auto_pri) && $source->storage->_supports_insert_returning + ? { returning => [ sort { $auto_pri{$a} <=> $auto_pri{$b} } keys %auto_pri ] } : () , ); @@ -484,7 +484,7 @@ the database row can not be constructed (see L for more details). -Also takes an optional hashref of C<< column_name => value> >> pairs +Also takes an optional hashref of C<< column_name => value >> pairs to update on the object first. Be aware that the hashref will be passed to C, which might edit it in place, so don't rely on it being the same after a call to C. If you