1 package DBIx::Class::CDBICompat::HasMany;
7 my ($class, $rel, $f_class, $f_key, $args) = @_;
11 if (ref $f_class eq 'ARRAY') {
12 ($f_class, @f_method) = @$f_class;
15 if (ref $f_key eq 'HASH' && !$args) { $args = $f_key; undef $f_key; };
18 if (delete $args->{no_cascade_delete}) {
19 $args->{cascade_delete} = 0;
22 $class->next::method($rel, $f_class, $f_key, $args);
26 no warnings 'redefine';
27 my $post_proc = sub { my $o = shift; $o = $o->$_ for @f_method; $o; };
28 *{"${class}::${rel}"} =
30 my $rs = shift->search_related($rel => @_);
31 $rs->{attrs}{record_filter} = $post_proc;
32 return (wantarray ? $rs->all : $rs);