@@ -18,10 +18,19 @@ Via Composer
1818$ composer require bcrowe/cakephp-api-pagination
1919```
2020
21- Load the plugin in your application' s ` bootstrap .php` file :
21+ Load the plugin by adding ` $this->addPlugin('BryanCrowe/ApiPagination'); ` to the ` bootsrap ` method in your project’ s ` src/Application .php` :
2222
2323``` php
24- Plugin::load('BryanCrowe/ApiPagination');
24+ public function bootstrap(): void
25+ {
26+ parent::bootstrap();
27+
28+ // ... bootstrap code ...
29+
30+ // load more plugins here
31+
32+ $this->addPlugin('BryanCrowe/ApiPagination');
33+ }
2534```
2635
2736## Usage
@@ -40,10 +49,9 @@ Then, go ahead and set your paginated view variable like so:
4049
4150``` php
4251$this->set('articles', $this->paginate($this->Articles));
43- $this->set('_serialize ', ['articles']);
52+ $this->viewBuilder()->setOption('serialize ', ['articles']);
4453```
45-
46- ** Note:** It is important that your ` _serialize ` variable is an array, e.g.
54+ ** Note:** It is important that your ` serialize ` option is an array, e.g.
4755` ['articles'] ` , so that your pagination information can be set under its own
4856pagination key.
4957
@@ -165,4 +173,4 @@ information.
165173[ link-downloads ] : https://packagist.org/packages/bcrowe/cakephp-api-pagination
166174[ link-author ] : https://github.com/bcrowe
167175[ link-contributors ] : ../../contributors
168- [ link-dataviews ] : http ://book.cakephp.org/3.0 /en/views/json-and-xml-views.html#enabling-data-views-in-your-application
176+ [ link-dataviews ] : https ://book.cakephp.org/4 /en/views/json-and-xml-views.html#enabling-data-views-in-your-application
0 commit comments