From a8757197c93eef29ec275d8bd61b21c6e4cb848a Mon Sep 17 00:00:00 2001 From: jfalbel <38588584+jfalbel@users.noreply.github.com> Date: Thu, 14 Jan 2021 12:24:13 +0100 Subject: [PATCH] The _serialize special view variables of JsonView are now deprecated After read https://github.com/bcrowe/cakephp-api-pagination/pull/5#issuecomment-656856385 According to de doc https://book.cakephp.org/4/en/appendices/4-0-migration-guide.html#view --- src/Controller/Component/ApiPaginationComponent.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Controller/Component/ApiPaginationComponent.php b/src/Controller/Component/ApiPaginationComponent.php index 3f12012..0d700f3 100644 --- a/src/Controller/Component/ApiPaginationComponent.php +++ b/src/Controller/Component/ApiPaginationComponent.php @@ -57,9 +57,9 @@ public function beforeRender(Event $event) } $subject->set($config['key'], $this->pagingInfo); - $data = $subject->viewBuilder()->getVar('_serialize') ?? []; + $data = $subject->viewBuilder()->getOption('serialize') ?? []; $data[] = $config['key']; - $subject->set('_serialize', $data); + $subject->viewBuilder()->setOption('serialize', $data); } /**