Implement DAO unsetAttribute

This commit is contained in:
Fabien Franzen 2014-08-19 22:05:27 +02:00 committed by Raymond Feng
parent 1705bd0f7f
commit 3b81b928fb
1 changed files with 9 additions and 0 deletions

View File

@ -1113,6 +1113,15 @@ DataAccessObject.prototype.setAttributes = function setAttributes(data) {
Model.emit('set', inst);
};
DataAccessObject.prototype.unsetAttribute = function unsetAttribute(name, nullify) {
if (nullify) {
this[name] = this.__data[name] = null;
} else {
delete this[name];
delete this.__data[name];
}
};
/**
* Update set of attributes.
* Performs validation before updating.