@@ -85,6 +85,7 @@ var singleInstance = (!CoreManager.get('IS_NODE'));
85
85
* @constructor
86
86
* @param {String } className The class name for the object
87
87
* @param {Object } attributes The initial set of data to store in the object.
88
+ * @param {Object } options The options for this object instance.
88
89
*/
89
90
export default class ParseObject {
90
91
/**
@@ -97,7 +98,7 @@ export default class ParseObject {
97
98
_objCount : number ;
98
99
className : string ;
99
100
100
- constructor ( className : ?string | { className : string , [ attr : string ] : mixed } , attributes ?: { [ attr : string ] : mixed } ) {
101
+ constructor ( className : ?string | { className : string , [ attr : string ] : mixed } , attributes ?: { [ attr : string ] : mixed } , options ?: { ignoreValidation : boolean } ) {
101
102
var toSet = null ;
102
103
this . _objCount = objectCount ++ ;
103
104
if ( typeof className === 'string' ) {
@@ -113,8 +114,11 @@ export default class ParseObject {
113
114
toSet [ attr ] = className [ attr ] ;
114
115
}
115
116
}
117
+ if ( attributes && typeof attributes === 'object' ) {
118
+ options = attributes ;
119
+ }
116
120
}
117
- if ( toSet && ! this . set ( toSet ) ) {
121
+ if ( toSet && ! this . set ( toSet , options ) ) {
118
122
throw new Error ( 'Can\'t create an invalid Parse Object' ) ;
119
123
}
120
124
// Enable legacy initializers
@@ -626,12 +630,14 @@ export default class ParseObject {
626
630
}
627
631
628
632
// Validate changes
629
- var validation = this . validate ( newValues ) ;
630
- if ( validation ) {
631
- if ( typeof options . error === 'function' ) {
632
- options . error ( this , validation ) ;
633
+ if ( ! options . ignoreValidation ) {
634
+ var validation = this . validate ( newValues ) ;
635
+ if ( validation ) {
636
+ if ( typeof options . error === 'function' ) {
637
+ options . error ( this , validation ) ;
638
+ }
639
+ return false ;
633
640
}
634
- return false ;
635
641
}
636
642
637
643
// Consolidate Ops
0 commit comments