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

Add an example to show how to create paginated result. #30

Closed
wants to merge 1 commit into from
Closed

Add an example to show how to create paginated result. #30

wants to merge 1 commit into from

Conversation

harikt
Copy link
Contributor

@harikt harikt commented Oct 13, 2016

Fixes #5 partially with documentation.

We can probably come with better ways later.

Thoughts ?

->paging(20);
$result = $query->fetchRecordSet();

$totalResult = clone $query;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what should we call this object. totalQuery ?

@pmjones
Copy link
Contributor

pmjones commented Oct 13, 2016

I wonder if the thing to do here is to add a new method (e.g. MapperSelect::count($col)) that does all that.

@harikt
Copy link
Contributor Author

harikt commented Oct 13, 2016

@pmjones I am good with your suggestion. Please also see #31 regarding the cloning issue.

pmjones pushed a commit that referenced this pull request Oct 13, 2016
@pmjones
Copy link
Contributor

pmjones commented Oct 13, 2016

@harikt Please see the new branch "counting" with this commit: 3642fce

The fetchCount() method gives a count of all rows. I suppose it would be good to have a fetchPageCount() as well, that divides by $select->getPaging() ?

@harikt
Copy link
Contributor Author

harikt commented Oct 14, 2016

Thanks Paul. Looks good to me.

I suppose it would be good to have a fetchPageCount() as well, that divides by $select->getPaging() ?

Any reason you didn't called it getPaging itself ?

@harikt
Copy link
Contributor Author

harikt commented Oct 14, 2016

One thing probably I think we could fix is the clone though. So if someone cloned it, it should not trouble them.

@pmjones
Copy link
Contributor

pmjones commented Oct 15, 2016

Fixed by 3642fce

@pmjones pmjones closed this Oct 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants