diff --git a/src/Parse/ParseObject.php b/src/Parse/ParseObject.php index ce704ae4..c93505d2 100755 --- a/src/Parse/ParseObject.php +++ b/src/Parse/ParseObject.php @@ -818,38 +818,42 @@ private function getSaveJSON() /** * Save Object to Parse * + * @param bool $useMasterKey Whether to use the Master Key. + * * @return null */ - public function save() + public function save($useMasterKey = false) { if (!$this->isDirty()) { return; } - static::deepSave($this); + static::deepSave($this, $useMasterKey); } /** * Save all the objects in the provided array * * @param array $list + * @param bool $useMasterKey Whether to use the Master Key. * * @return null */ - public static function saveAll($list) + public static function saveAll($list, $useMasterKey = false) { - static::deepSave($list); + static::deepSave($list, $useMasterKey); } /** * Save Object and unsaved children within. * * @param $target + * @param bool $useMasterKey Whether to use the Master Key. * * @return null * * @throws ParseException */ - private static function deepSave($target) + private static function deepSave($target, $useMasterKey = false) { $unsavedChildren = array(); $unsavedFiles = array(); @@ -916,7 +920,7 @@ private static function deepSave($target) $batch[0]->mergeAfterSave($result); } else { $result = ParseClient::_request('POST', '/1/batch', $sessionToken, - json_encode(array("requests" => $requests))); + json_encode(array("requests" => $requests)), $useMasterKey); $errorCollection = array();