From: Peter Rabbitson Date: Sun, 15 May 2016 20:52:18 +0000 (+0200) Subject: Rollback some mistaken indirect-call-elisions from e5053694 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ab1043a6bf062356fd698fc984a22abf674885ef;hp=dd1853390485b141d014a59aa550fba966493784;p=dbsrgits%2FDBIx-Class.git Rollback some mistaken indirect-call-elisions from e5053694 The ::Realtionship::Base calls perform result-instance adjustments, thus they CAN NOT be omitted That would have been *really* embarrassing, good thing dependent smoking caught this crap. Not adding an extra test at this point, but probably should :/ Audit was performed by scrutinizing each line of: grep -- '->' \ <(git diff -U0 e50536940^..e50536940) \ <(git diff -U0 77c3a5dca^..77c3a5dca) \ > argh.log --- diff --git a/lib/DBIx/Class/Relationship/Accessor.pm b/lib/DBIx/Class/Relationship/Accessor.pm index fae251e..0dab640 100644 --- a/lib/DBIx/Class/Relationship/Accessor.pm +++ b/lib/DBIx/Class/Relationship/Accessor.pm @@ -100,8 +100,8 @@ EOC } elsif ($acc_type eq 'multi') { - quote_sub "${class}::${rel}_rs", "shift->related_resultset('$rel')->search_rs( \@_ )"; - quote_sub "${class}::add_to_${rel}", "shift->related_resultset('$rel')->new_result( \@_ )->insert"; + quote_sub "${class}::${rel}_rs", "shift->related_resultset( q{$rel} )->search_rs( \@_ )"; + quote_sub "${class}::add_to_${rel}", "shift->create_related( q{$rel} => \@_ )"; quote_sub "${class}::${rel}", sprintf( <<'EOC', perlstring $rel ); DBIx::Class::_ENV_::ASSERT_NO_INTERNAL_WANTARRAY and my $sog = DBIx::Class::_Util::fail_on_internal_wantarray; shift->related_resultset(%s)->search( @_ ) diff --git a/lib/DBIx/Class/Relationship/Base.pm b/lib/DBIx/Class/Relationship/Base.pm index 323c31e..994e7d7 100644 --- a/lib/DBIx/Class/Relationship/Base.pm +++ b/lib/DBIx/Class/Relationship/Base.pm @@ -767,7 +767,7 @@ sub find_or_create_related { my $self = shift; my $rel = shift; my $obj = $self->related_resultset($rel)->find(@_); - return (defined($obj) ? $obj : $self->related_resultset($rel)->new_result(@_)->insert); + return (defined($obj) ? $obj : $self->create_related( $rel => @_ )); } =head2 update_or_create_related diff --git a/lib/DBIx/Class/Relationship/ProxyMethods.pm b/lib/DBIx/Class/Relationship/ProxyMethods.pm index f7585a7..cb61514 100644 --- a/lib/DBIx/Class/Relationship/ProxyMethods.pm +++ b/lib/DBIx/Class/Relationship/ProxyMethods.pm @@ -28,7 +28,7 @@ sub proxy_to_related { my $self = shift; my $relobj = $self->%1$s; if (@_ && !defined $relobj) { - $relobj = $self->related_resultset(q{%1$s})->new_result({ %2$s => $_[0] })->insert; + $relobj = $self->create_related( q{%1$s} => { %2$s => $_[0] } ); @_ = (); } $relobj ? $relobj->%2$s(@_) : undef;