parse.com-php-library
parse.com-php-library copied to clipboard
Any way to use Add or AddUnique
Is the library have these built in or should I just use the basic REST api?
I just used this in a script:
$parseSpeaker = new Object($parseConfig, 'speaker'); $parseSpeaker->name = $s['name']; $parseSpeaker->picture = $s['picture']; $parseSpeaker->resume = $s['resume']; $parseSpeaker->sitesCollection = array('__op' => 'Add', 'objects' => $s['sites']); $r = $parseSpeaker->save();
$s['sites'] is an normal PHP array.
I don't know if this is the right way, but it works ;)
Interesting! This is with the V1 it seems like, since the newer API uses ParseObject(classname) to declare. I'm getting an internal error! Arggg. Thanks for the assist though.
Sorry, i'm using another version
You have to change the $parseSpeaker = new Object($parseConfig, 'speaker');
for
$parseSpeaker = new ParseObject('speaker');
I did a pull request to this change ;)
By the way, AddUnique works this way also in case anyone is wondering:
$parseSpeaker->sitesCollection = array('__op' => 'AddUnique', 'objects' => $s['sites']); $r = $parseSpeaker->update($speakerObjectId);