Skip to content

Commit

Permalink
Updating PaginatorHelper and its test cases to use the request object.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed May 14, 2010
1 parent c5dfd12 commit 3983bf3
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 115 deletions.
24 changes: 12 additions & 12 deletions cake/libs/view/helpers/paginator.php
Expand Up @@ -107,7 +107,7 @@ function __construct($config = array()) {
* @return void
*/
public function beforeRender() {
$this->options['url'] = array_merge($this->params['pass'], $this->params['named']);
$this->options['url'] = array_merge($this->request->params['pass'], $this->request->params['named']);

parent::beforeRender();
}
Expand All @@ -122,10 +122,10 @@ public function params($model = null) {
if (empty($model)) {
$model = $this->defaultModel();
}
if (!isset($this->params['paging']) || empty($this->params['paging'][$model])) {
if (!isset($this->request->params['paging']) || empty($this->request->params['paging'][$model])) {
return null;
}
return $this->params['paging'][$model];
return $this->request->params['paging'][$model];
}

/**
Expand All @@ -141,20 +141,20 @@ public function options($options = array()) {
}

if (!empty($options['paging'])) {
if (!isset($this->params['paging'])) {
$this->params['paging'] = array();
if (!isset($this->request->params['paging'])) {
$this->request->params['paging'] = array();
}
$this->params['paging'] = array_merge($this->params['paging'], $options['paging']);
$this->request->params['paging'] = array_merge($this->request->params['paging'], $options['paging']);
unset($options['paging']);
}
$model = $this->defaultModel();

if (!empty($options[$model])) {
if (!isset($this->params['paging'][$model])) {
$this->params['paging'][$model] = array();
if (!isset($this->request->params['paging'][$model])) {
$this->request->params['paging'][$model] = array();
}
$this->params['paging'][$model] = array_merge(
$this->params['paging'][$model], $options[$model]
$this->request->params['paging'][$model] = array_merge(
$this->request->params['paging'][$model], $options[$model]
);
unset($options[$model]);
}
Expand Down Expand Up @@ -486,10 +486,10 @@ public function defaultModel() {
if ($this->__defaultModel != null) {
return $this->__defaultModel;
}
if (empty($this->params['paging'])) {
if (empty($this->request->params['paging'])) {
return null;
}
list($this->__defaultModel) = array_keys($this->params['paging']);
list($this->__defaultModel) = array_keys($this->request->params['paging']);
return $this->__defaultModel;
}

Expand Down

0 comments on commit 3983bf3

Please sign in to comment.