Let’s say you have a Posts controller, where you’ll need to paginate some posts in various actions.
You might have some “generic settings” as the manual recommends in your $paginate variable similar to this:
Now, the above setting is probably going to work well for all of your actions where pagination is required. However, in some actions you need to also add a ‘contain’ key and maybe some ‘conditions’…
We can easily merge our main “setting” and any other desired keys we’d normally pass to $paginate, by using Set::merge()
Let’s say this is our extendedView() action of the Posts controller: