Merge branch 'current/for_cpan_index' into current/dq
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / ResultSet / WithDQMethods.pm
1 package DBIx::Class::ResultSet::WithDQMethods;
2
3 use Scalar::Util qw(blessed);
4 use Moo;
5 use Moo::Object;
6 use namespace::clean;
7
8 extends 'DBIx::Class::ResultSet';
9
10 with 'DBIx::Class::ResultSet::Role::DQMethods';
11
12 sub BUILDARGS {
13   if (@_ <= 3 and blessed($_[1])) { # ->new($source, $attrs?)
14     return $_[2]||{};
15   }
16   return Moo::Object::BUILDARGS(@_);
17 }
18
19 sub FOREIGNBUILDARGS {
20   if (@_ <= 3 and blessed($_[1])) { # ->new($source, $attrs?)
21     return ($_[1], $_[2]);
22   }
23   my $args = Moo::Object::BUILDARGS(@_);
24   my $source = delete $args->{result_source};
25   return ($source, $args);
26 }
27
28 1;