Skip to content

Commit f5c2cae

Browse files
authored
Merge pull request #11 from LukeC8/patch-2
Add support to "serialize" option when set to true
2 parents 707ab84 + 12471b1 commit f5c2cae

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Controller/Component/ApiPaginationComponent.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ public function beforeRender(Event $event)
5959

6060
$subject->set($config['key'], $this->pagingInfo);
6161
$data = $subject->viewBuilder()->getOption('serialize') ?? [];
62-
$data[] = $config['key'];
63-
$subject->viewBuilder()->setOption('serialize', $data);
62+
63+
if (is_array($data)) {
64+
$data[] = $config['key'];
65+
$subject->viewBuilder()->setOption('serialize', $data);
66+
}
6467
}
6568

6669
/**

0 commit comments

Comments
 (0)