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

Support query with count #448

Merged
merged 2 commits into from Jul 23, 2019
Merged

Support query with count #448

merged 2 commits into from Jul 23, 2019

Conversation

dplewis
Copy link
Member

@dplewis dplewis commented Jul 23, 2019

See parse-community/Parse-SDK-JS#868

$query->withCount();
$response = $query->find();
$response['count'] // total number of objects despite limit / skip
$response['results'] // Array of objects

As of PHP 7.1 you can use Array Destructuring like es6

['count' => $count, 'results' => $results] = $query->find();
$count // total
$results // array

Copy link
Member

@davimacedo davimacedo left a comment

Choose a reason for hiding this comment

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

LGTM!

@dplewis dplewis merged commit 942dcc2 into master Jul 23, 2019
@dplewis dplewis deleted the with-count branch July 23, 2019 05:03
dplewis added a commit to parse-community/docs that referenced this pull request Jul 23, 2019
TomWFox pushed a commit to parse-community/docs that referenced this pull request Jul 23, 2019
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