1.26 Stable and Pagination

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

1.26 Stable and Pagination

MikeK-2
IWe're working on an upgrade to 1.26 stable and are finding a lot of
references to issues in the pagination helper in which parameter #2 to
array_merge is not an array. var_dump shows they are indeed arrays,
and this is usually on the url parameter.

See refs to url lines 258 and 344 in the paginator helper code.

The error is flagged when using paginator helper methods where url is
set using syntax such as
$options = array( 'url' => $somevar);

Casting the refs in the paginator code to be (array) makes everything
work properly.
344 org: $url = array_merge(array('page' => $paging['page'] + ($which
== 'Prev' ? $step * -1 : $step)), $url);
344 fix: $url = array_merge(array('page' => $paging['page'] + ($which
== 'Prev' ? $step * -1 : $step)), (array)$url);

So does changing the input in the view to
$options = array(array( 'url' => $somevar));

Looking at the spec for the options in those functions it does not
appear that urls must be an array within the options array, but is
this stated elsewhere?

Just trying to get it right before hitting a bunch of pagination code
for updates. I noticed in an older release that in internal function
in the paginator helper called am() used to be used and it did some
manipulation which made our original syntax work. Should we input a PR
into the system or are all our input references actually wrong?

Other than plugging in a new cake core behind our 10,000 lines of cake
code how would we know this type of change was out there? Is there a
summary list that shows API changes and functions deprecated across
releases to ease forward migration of large code bases? Bashing
through the migration like this is quite painful :(

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Reply | Threaded
Open this post in threaded view
|

Re: 1.26 Stable and Pagination

phpMagpie
You misunderstand the error and/or the output of your var_dump.  The
url parameter in your options array is not an array it's a variable,
signified by the fact you call it $somevar.

$options = array( 'url' => $somevar);

Try

$options = array( 'url' => array($somevar));

I personally have my pagination options in an element as I want them
to be the same across my application and at the top of that element I
include the following to automatically include any passed arguments
from the URL into the pagination links

if (!empty($this->passedArgs)) {
        $paginator->options(array('url' => $this->passedArgs));
} ?>

HTH

Paul.

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en