apotropaic/parse.com-php-library — Issue #6: object counting
Author: crabacus
Created: 2012-03-09 00:26:23+00:00
State: open

The REST API supports object counting, but that seems to be missing from your implementation. I made a couple of additions to my copy of the class which seems to have successfully implemented the feature.

on line 58:

if(isset($args['count'])){
$postData['count'] = $args['count'];
}

and one line 164:

if(isset($args['count'])){
$params['count'] = $args['count'];
}

This allows you to count all objects in a class with params:

$params = array(
'className' => 'ClassName',
'limit' => 0,
'count' => 1
);
$request = $parse->query($params);

Or alternatively count rows matching a query:

$params = array(
'className' => 'ClassName',
'query' => array(
'TextField' => 'TextValue'
),
'limit' => 0,
'count' => 1
);
$request = $parse->query($params);