fixed static configured page attribute not being used (RT#56226)
[catagits/Catalyst-Controller-DBIC-API.git] / lib / Catalyst / Controller / DBIC / API / RequestArguments.pm
index adba96d..f490eed 100644 (file)
@@ -10,7 +10,6 @@ use namespace::autoclean;
 
 use Catalyst::Controller::DBIC::API::JoinBuilder;
 
-
 =attribute_private search_validator
 
 A Catalyst::Controller::DBIC::API::Validator instance used solely to validate search parameters
@@ -198,13 +197,13 @@ Like the synopsis in DBIC::API shows, you can declare a "template" of what is al
         {
             my ($self, $new) = @_;
 
-            sub check_rel {
+            sub _check_rel {
                 my ($self, $rel, $static) = @_;
                 if(ArrayRef->check($rel))
                 {
                     foreach my $rel_sub (@$rel)
                     {
-                        $self->check_rel($rel_sub, $static);
+                        $self->_check_rel($rel_sub, $static);
                     }
                 }
                 elsif(HashRef->check($rel))
@@ -224,7 +223,7 @@ Like the synopsis in DBIC::API shows, you can declare a "template" of what is al
 
             foreach my $rel (@$new)
             {
-                $self->check_rel($rel, $p->static);
+                $self->_check_rel($rel, $p->static);
             }
         },
     );
@@ -512,7 +511,7 @@ generate_column_parameters recursively generates properly aliased parameters for
     {
         my ($self, $source, $param, $join, $base) = @_;
         $base ||= 'me';
-        my $search_params;
+        my $search_params = {};
 
         # build up condition
         foreach my $column (keys %$param)
@@ -525,8 +524,7 @@ generate_column_parameters recursively generates properly aliased parameters for
                     next;
                 }
 
-                %$search_params =
-                %{
+                $search_params = { %$search_params, %{
                     $self->generate_column_parameters
                     (
                         $source->related_source($column),
@@ -534,7 +532,7 @@ generate_column_parameters recursively generates properly aliased parameters for
                         Catalyst::Controller::DBIC::API::JoinBuilder->new(parent => $join, name => $column),
                         $column
                     )
-                };
+                }};
             }
             else
             {
@@ -576,6 +574,7 @@ This builder method generates the search attributes
             as => $self->as || ((scalar(@{$static->as})) ? $static->as : undef),
             prefetch => $self->prefetch || $static->prefetch || undef,
             rows => $self->count || $static->count,
+            page => $static->page,
             offset => $self->offset,
             join => $self->build_joins,
         };