Projection.ModelWithoutValidation Class
addon/models/model-without-validation.js:12
Base model that supports projections and copying.
Item Index
Methods
Properties
Methods
_saveBelongsToObserver
-
sender
-
key
Save canonical state for belongsTo
relationships.
_saveCanonicalBelongsTo
()
private
Set each belongsTo
relationship, observer, that save canonical state.
beforeSave
-
[options]
Triggers model's 'preSave' event & allows to execute some additional async logic before model will be saved.
Parameters:
Returns:
A promise that will be resolved after all 'preSave' event handlers promises will be resolved
changedBelongsTo
()
Object
Return object with changes.
Object will have structure:
- key - is name relationships that has changed
- array - include two items, old value, with index
0
, and new value, with index1
.
- array - include two items, old value, with index
Returns:
Object with changes, empty object if no change.
Example:
{
key: [oldValue, newValue],
}
changedHasMany
()
Object
Return object with changes.
Object will have structure:
- key - is name relationships that has changed
- array - include two array, array with index
0
this old values, array with index1
this new values.
- array - include two array, array with index
Returns:
Object with changes, empty object if no change.
Example:
{
key: [
[oldValues],
[newValues],
],
}
defineIdType
-
newIdType
Defines idType for specified model type.
Parameters:
-
newIdType
StringModel id type.
defineProjection
-
projectionName
-
modelName
-
attributes
Defines projection for specified model type.
Parameters:
Returns:
Created projection.
hasChangedBelongsTo
()
Boolean
Сheck whether there is a changed belongsTo
relationships.
Returns:
Returns true
if belongsTo
relationships have changed, else false
.
hasChangedHasMany
()
Boolean
Сheck whether there is a changed hasMany
relationships.
Returns:
Returns true
if hasMany
relationships are changed.
makeDirty
()
Turns model into 'updated.uncommitted' state.
Transition into the updated.uncommitted
state
if the model in the saved
state (no local changes).
Alternative: this.get('currentState').becomeDirty();
preSaveSetId
()
Sets Id on preSave.
rollbackAll
()
Rollback all changes.
rollbackBelongsTo
-
[forOnlyKey]
Rollback changes for belongsTo
relationships.
Parameters:
-
[forOnlyKey]
String optionalIf specified, it is rollback invoked for relationship with this key.
rollbackHasMany
-
[forOnlyKey]
Rollback changes for hasMany
relationships.
Parameters:
-
[forOnlyKey]
String optionalIf specified, it is rollback invoked for relationship with this key.
rollbackRelationships
()
Rollback changes for all relationships.
Properties
isCreatedDuringSyncUp
Boolean
Flag that indicates model is created during sync up process.
Default: false
isCreatedDuringSyncUp
Boolean
Flag that indicates model is updated last time during sync up process.
Default: false
isCreatedDuringSyncUp
Boolean
Flag that indicates model is destroyed during sync up process.
Default: false