mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Moving limit from the options to the normal paging params. This fixes a few notice errors.
This commit is contained in:
parent
176d5520f6
commit
cc2d8e2fec
4 changed files with 6 additions and 11 deletions
|
@ -195,6 +195,7 @@ class PaginatorComponent extends Component {
|
|||
'nextPage' => ($count > ($page * $limit)),
|
||||
'pageCount' => $pageCount,
|
||||
'order' => $order,
|
||||
'limit' => $limit,
|
||||
'options' => Set::diff($options, $defaults),
|
||||
'paramType' => $options['paramType']
|
||||
);
|
||||
|
|
|
@ -525,9 +525,9 @@ class PaginatorHelper extends AppHelper {
|
|||
}
|
||||
$start = 0;
|
||||
if ($paging['count'] >= 1) {
|
||||
$start = (($paging['page'] - 1) * $paging['options']['limit']) + 1;
|
||||
$start = (($paging['page'] - 1) * $paging['limit']) + 1;
|
||||
}
|
||||
$end = $start + $paging['options']['limit'] - 1;
|
||||
$end = $start + $paging['limit'] - 1;
|
||||
if ($paging['count'] < $end) {
|
||||
$end = $paging['count'];
|
||||
}
|
||||
|
|
|
@ -306,6 +306,8 @@ class PaginatorTest extends CakeTestCase {
|
|||
$Controller->request->params['named'] = array();
|
||||
$Controller->Paginator->settings = array('limit' => '-1', 'maxLimit' => 10, 'paramType' => 'named');
|
||||
$Controller->Paginator->paginate('PaginatorControllerPost');
|
||||
|
||||
$this->assertIdentical($Controller->params['paging']['PaginatorControllerPost']['limit'], 1);
|
||||
$this->assertIdentical($Controller->params['paging']['PaginatorControllerPost']['page'], 1);
|
||||
$this->assertIdentical($Controller->params['paging']['PaginatorControllerPost']['pageCount'], 3);
|
||||
$this->assertIdentical($Controller->params['paging']['PaginatorControllerPost']['prevPage'], false);
|
||||
|
|
|
@ -1966,18 +1966,10 @@ class PaginatorHelperTest extends CakeTestCase {
|
|||
'prevPage' => false,
|
||||
'nextPage' => true,
|
||||
'pageCount' => 5,
|
||||
'defaults' => array(
|
||||
'limit' => 3,
|
||||
'step' => 1,
|
||||
'order' => array('Client.name' => 'DESC'),
|
||||
'conditions' => array()
|
||||
),
|
||||
'limit' => 3,
|
||||
'options' => array(
|
||||
'page' => 1,
|
||||
'limit' => 3,
|
||||
'order' => array('Client.name' => 'DESC'),
|
||||
'conditions' => array(),
|
||||
'separator' => 'of'
|
||||
),
|
||||
)
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue