I may be missing something simple but I thought I would ask here since I was unable to find any information on the subject of saving an array of pointers with the parse php sdk.
I have a list of object id's from the Groups Class, and I want to save those object id's as an array of pointers to my 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 with code: " . $e->getMessage());
}
$data is an array of object group object ID's
any help would be appreciated.
[ { "__type": "Pointer", "className": "Comment", "objectId": "5JbTj2k7hx" }, { "__type": "Pointer", "className": "Comment", "objectId": "oo69vxrQG0" } ]Note this is for another collection but im trying to repo this now with the parse php sdk for groups associated with an org.