Skip to content

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.

3 participants