parse.com-php-library icon indicating copy to clipboard operation
parse.com-php-library copied to clipboard

Any way to use Add or AddUnique

Open social-ink opened this issue 11 years ago • 4 comments

Is the library have these built in or should I just use the basic REST api?

social-ink avatar Oct 29 '13 19:10 social-ink

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 ;)

eminetto avatar Oct 29 '13 20:10 eminetto

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.

social-ink avatar Oct 29 '13 20:10 social-ink

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 ;)

eminetto avatar Oct 29 '13 20:10 eminetto

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);

jameswilsterman avatar Nov 19 '13 01:11 jameswilsterman