parse.com - Parse PHP saving an array of pointers -
i may missing simple thought ask here since unable find information on subject of saving array of pointers parse php sdk.
i have list of object id's groups class, , want save object id's array of pointers organization class.
try { $query = new parsequery("organization"); $query->equalto('objectid', $objectid); $results = $query->first($usemasterkey = true); $groups = parseobject::create('organization', $data, true); $groups->set("test1" , $groups); $groups->save($usemasterkey = true); $results->setarray("groups", $data); //$results->setarray("test1", array('__type' => 'pointer', 'classname' => 'group', 'objectid' => $data[0])); //$results->setassociativearray("test1", array($groups[0])); $results->save($usemasterkey = true); } catch (\exception $e){ print("an error has occurred code: " . $e->getmessage()); }
$data array of object group object id's
any appreciated.
ok, here how ended doing if else runs situation.
looking on ios app have creates similar output in database functionality
comment(withoutdatawithobjectid: apossibleobjectidstring)
helps create array of looks pointers.
[ { "__type": "pointer", "classname": "group", "objectid": "5jbtj2k7hx" }, { "__type": "pointer", "classname": "group", "objectid": "oo69vxrqg0" } ]
this pasted database. allows client pull things in pointer somehow..
honestly i'm not sure best way ended using.
// hack add pointer type data array type column. // value objectid groups collection. foreach($data $value) { $groups[] = array( "__type" => "pointer", "classname" => "group", "objectid" => $value ); } try { $query = new parsequery("organization"); $query->equalto('objectid', $objectid); $results = $query->first($usemasterkey = true); $results->setarray("grouppointer", $groups); // actual data generated .. $results->setarray("groups", $data); $results->save($usemasterkey = true); } catch (\exception $e){ print("an error has occurred code: " . $e->getmessage()); }
Comments
Post a Comment