« All deprecation guides
Deprecation Guide for Record Lifecycle Event Methods
until: 4.0.0
id: ember-data:record-lifecycle-event-methods
Deprecating Record Lifecycle Event Methods
As described in 'RFC 0329' -
...the following lifecycle methods on DS.Model will also be deprecated: becameError, becameInvalid, didCreate, didDelete, didLoad, didUpdate, ready, rolledBack.
When a model is instantiated for the first time with any of these methods a deprecation warning will be logged notifiying the user that this method will be deprecated and the user should use an computed or overide the model's init method instead.
The work of lifecycle events can be achieved with a computed property on a relevant property or kick off additional work when performing the operation.
Some Examples of CP Alternatives:
- becameError - CP on isError
- becameInvalid - CP on isValid
- didCreate - CP on isNew
- didDelete - CP on isDeleted
- didLoad - CP on isLoaded
- didUpdate - CP on hasDirtyAttributes
Other workarounds can be done at the time of interacting with the model.
For example, the following could be an alternative to using the didLoad
event.
store.findRecord('model', 1).then(function(model) {
performModelLoadedTask(model);
});