You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 25, 2018. It is now read-only.
I added a function called relate to add or remove a relation to your code. Not that good at github, so here is the function:
/**
*
* Used to add or remove a relation to a parse.com object
*
* @param array $args - argument hash:
*
* className: string of className
* objectId: the objectId of the object you want to update
* add: boolean
* columnName: the column name of the relation
* relationClassName: the classname of the relation you want to add
* relationObjectId: the objectId of the related object
*/
public function relate($args){
$params = array(
'url' => $args['className'].'/'.$args['objectId'],
'method' => 'PUT'
);
$objects = array(
"__type" => "Pointer",
"className" => $args['relationClassName'],
"objectId" => $args['relationObjectId']
);
$relation = array(
$args['columnName'] => array(
"__op" =>
($args['add'] ? "Add" : "Remove") . "Relation",
"objects" => array($objects)
)
);
$params['payload'] = $relation;
$return = $this->request($params);
return $this->checkResponse($return,'200');
}
The text was updated successfully, but these errors were encountered:
I added a function called relate to add or remove a relation to your code. Not that good at github, so here is the function:
The text was updated successfully, but these errors were encountered: