@@ -818,24 +818,27 @@ private function getSaveJSON()
818
818
/**
819
819
* Save Object to Parse
820
820
*
821
+ * @param bool $useMasterKey Whether to use the Master Key.
822
+ *
821
823
* @return null
822
824
*/
823
- public function save ()
825
+ public function save ($ useMasterKey = false )
824
826
{
825
827
if (!$ this ->isDirty ()) {
826
828
return ;
827
829
}
828
- static ::deepSave ($ this );
830
+ static ::deepSave ($ this , $ useMasterKey );
829
831
}
830
832
831
833
/**
832
834
* Save all the objects in the provided array
833
835
*
834
836
* @param array $list
837
+ * @param bool $useMasterKey Whether to use the Master Key.
835
838
*
836
839
* @return null
837
840
*/
838
- public static function saveAll ($ list )
841
+ public static function saveAll ($ list, $ useMasterKey = false )
839
842
{
840
843
static ::deepSave ($ list );
841
844
}
@@ -844,12 +847,13 @@ public static function saveAll($list)
844
847
* Save Object and unsaved children within.
845
848
*
846
849
* @param $target
850
+ * @param bool $useMasterKey Whether to use the Master Key.
847
851
*
848
852
* @return null
849
853
*
850
854
* @throws ParseException
851
855
*/
852
- private static function deepSave ($ target )
856
+ private static function deepSave ($ target, $ useMasterKey = false )
853
857
{
854
858
$ unsavedChildren = array ();
855
859
$ unsavedFiles = array ();
@@ -916,7 +920,7 @@ private static function deepSave($target)
916
920
$ batch [0 ]->mergeAfterSave ($ result );
917
921
} else {
918
922
$ result = ParseClient::_request ('POST ' , '/1/batch ' , $ sessionToken ,
919
- json_encode (array ("requests " => $ requests )));
923
+ json_encode (array ("requests " => $ requests )), $ useMasterKey );
920
924
921
925
$ errorCollection = array ();
922
926
0 commit comments