Skip to content

Commit c8e36f2

Browse files
committed
Set subject local var
1 parent 0e6b45a commit c8e36f2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Controller/Component/ApiPaginationComponent.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ public function implementedEvents()
4949
*/
5050
public function beforeRender(Event $event)
5151
{
52+
$subject = $event->subject();
53+
5254
if (!$this->isPaginatedApiRequest()) {
5355
return;
5456
}
5557

56-
$this->pagingInfo = $this->request->params['paging'][$event->subject()->name];
58+
$this->pagingInfo = $this->request->params['paging'][$subject->name];
5759
$config = $this->config();
5860

5961
if (!empty($config['aliases'])) {
@@ -64,8 +66,8 @@ public function beforeRender(Event $event)
6466
$this->setVisibility();
6567
}
6668

67-
$event->subject()->set($config['key'], $this->pagingInfo);
68-
$event->subject()->viewVars['_serialize'][] = $config['key'];
69+
$subject->set($config['key'], $this->pagingInfo);
70+
$subject->viewVars['_serialize'][] = $config['key'];
6971
}
7072

7173
/**

0 commit comments

Comments
 (0)