Corrected columns_info_for indent level - 2 space indent everyone please, you may...
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Relationship / ManyToMany.pm
CommitLineData
c0e7b4e5 1package # hide from PAUSE
2 DBIx::Class::Relationship::ManyToMany;
8973b6f1 3
4use strict;
5use warnings;
6
7sub many_to_many {
78af1010 8 my ($class, $meth, $rel, $f_rel, $rel_attrs) = @_;
8973b6f1 9 {
10 no strict 'refs';
11 no warnings 'redefine';
78af1010 12 *{"${class}::${meth}"} = sub {
0f6ac8bb 13 my $self = shift;
14 my $attrs = @_ > 1 && ref $_[$#_] eq 'HASH' ? pop(@_) : {};
aeb1bf75 15 $self->search_related($rel)->search_related($f_rel, @_ > 0 ? @_ : undef, { %{$rel_attrs||{}}, %$attrs });
78af1010 16 };
8973b6f1 17 }
18}
19
201;