}
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( @_ )
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
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;