Skip to content

Commit

Permalink
Merge pull request #11 from LukeC8/patch-2
Browse files Browse the repository at this point in the history
Add support to "serialize" option when set to true
  • Loading branch information
bcrowe authored Jul 1, 2021
2 parents 707ab84 + 12471b1 commit f5c2cae
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Controller/Component/ApiPaginationComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ public function beforeRender(Event $event)

$subject->set($config['key'], $this->pagingInfo);
$data = $subject->viewBuilder()->getOption('serialize') ?? [];
$data[] = $config['key'];
$subject->viewBuilder()->setOption('serialize', $data);

if (is_array($data)) {
$data[] = $config['key'];
$subject->viewBuilder()->setOption('serialize', $data);
}
}

/**
Expand Down

0 comments on commit f5c2cae

Please sign in to comment.