Commit | Line | Data |
---|---|---|
8973b6f1 | 1 | package DBIx::Class::Relationship::ManyToMany; |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | ||
6 | sub many_to_many { | |
78af1010 | 7 | my ($class, $meth, $rel, $f_rel, $rel_attrs) = @_; |
8 | $rel_attrs ||= {}; | |
8973b6f1 | 9 | |
10 | { | |
11 | no strict 'refs'; | |
12 | no warnings 'redefine'; | |
78af1010 | 13 | *{"${class}::${meth}"} = sub { |
14 | my ($self,$cond,$attrs) = @_; | |
15 | $self->search_related($rel)->search_related($f_rel, $cond, { %$rel_attrs, %{$attrs||{}} }); | |
16 | }; | |
8973b6f1 | 17 | } |
18 | } | |
19 | ||
20 | 1; |