X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRelationship%2FAccessor.pm;h=b20eb1684f221b7f0b409695d063fbdbe06be961;hb=a28009914a3e447af53737d503b1953160d146c9;hp=e98c9a21375e7765397282ce356a847e28a85fa1;hpb=bd3d5a5e91e959cc7f4fcf0d10a15d65412115b9;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Relationship/Accessor.pm b/lib/DBIx/Class/Relationship/Accessor.pm index e98c9a2..b20eb16 100644 --- a/lib/DBIx/Class/Relationship/Accessor.pm +++ b/lib/DBIx/Class/Relationship/Accessor.pm @@ -62,40 +62,4 @@ sub add_relationship_accessor { } } -sub new { - my ($class, $attrs, @rest) = @_; - my ($related, $info); - foreach my $key (keys %{$attrs||{}}) { - next unless $info = $class->relationship_info($key); - $related->{$key} = delete $attrs->{$key} - if ref $attrs->{$key} - && $info->{attrs}{accessor} - && $info->{attrs}{accessor} eq 'single'; - } - my $obj = $class->next::method($attrs, @rest); - if ($related) { - $obj->{_relationship_data} = $related; - foreach my $rel (keys %$related) { - $obj->set_from_related($rel, $related->{$rel}); - } - } - return $obj; -} - -sub update { - my ($obj, $attrs, @rest) = @_; - $attrs = { %$attrs} if $attrs; # Take copy so we dont change passed hashref - my $info; - foreach my $key (keys %{$attrs||{}}) { - next unless $info = $obj->relationship_info($key); - if (ref $attrs->{$key} && $info->{attrs}{accessor} - && $info->{attrs}{accessor} eq 'single') { - my $rel = delete $attrs->{$key}; - $obj->set_from_related($key => $rel); - $obj->{_relationship_data}{$key} = $rel; - } - } - return $obj->next::method($attrs, @rest); -} - 1;