Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.0.x] The Model Paginator now iterates over the models. #10251

Merged
merged 1 commit into from
May 6, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions phalcon/paginator/adapter/model.zep
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Model extends Adapter implements AdapterInterface
*/
public function getPaginate() -> <\stdclass>
{
var config, items, pageItems, page, valid;
var config, items, pageItems, page;
int pageNumber, show, n, start, lastShowPage,
i, next, totalPages, before;

Expand Down Expand Up @@ -117,18 +117,13 @@ class Model extends Adapter implements AdapterInterface

//The record must be iterable
let i = 1;
loop {

let valid = items->valid();
if valid == false {
break;
}

while items->valid() {
let pageItems[] = items->current();
if i >= show {
break;
}
let i++;
items->next();
}
}

Expand Down