Skip to content

Commit

Permalink
Fix deprecated request property use in paginator helper & tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Dec 9, 2017
1 parent cedd563 commit 51abd06
Show file tree
Hide file tree
Showing 2 changed files with 194 additions and 167 deletions.
18 changes: 9 additions & 9 deletions src/View/Helper/PaginatorHelper.php
Expand Up @@ -104,7 +104,7 @@ public function __construct(View $View, array $config = [])
unset($query['page'], $query['limit'], $query['sort'], $query['direction']);
$this->setConfig(
'options.url',
array_merge($this->request->getParam('pass'), ['?' => $query])
array_merge($this->request->getParam('pass', []), ['?' => $query])
);
}

Expand Down Expand Up @@ -153,19 +153,19 @@ public function param($key, $model = null)
public function options(array $options = [])
{
if (!empty($options['paging'])) {
if (!$this->request->getParam('paging')) {
$this->request->params['paging'] = [];
}
$this->request->params['paging'] = $options['paging'] + $this->request->getParam('paging');
$this->request = $this->request->withParam(
'paging',
$options['paging'] + $this->request->getParam('paging', [])
);
unset($options['paging']);
}
$model = $this->defaultModel();

if (!empty($options[$model])) {
if (!$this->request->getParam('paging.' . $model)) {
$this->request->params['paging'][$model] = [];
}
$this->request->params['paging'][$model] = $options[$model] + $this->request->getParam('paging.' . $model);
$this->request = $this->request->withParam(
'paging.' . $model,
$options[$model] + (array)$this->request->getParam('paging.' . $model, [])
);
unset($options[$model]);
}
$this->_config['options'] = array_filter($options + $this->_config['options']);
Expand Down

0 comments on commit 51abd06

Please sign in to comment.