不要怂,就是干,撸起袖子干!

Commit 770c10c9 by Jochem Maas

implement object "attribute" (aka fields) property getters/setters on DAOs such …

…that custom object property getter/setter functions can be applied to a DAO instance (not yet implemented, but I suspect in to be defined along-side "instanceMethods"), all attribute values ar enow stored in a "dataValues" property and transparently made available for setting and getting via object property get/set functions
1 parent edef6294
Showing with 5 additions and 2 deletions
......@@ -7,7 +7,7 @@ module.exports = (function() {
var DAO = function(values, options, isNewRecord) {
var self = this
this.dataValues = []
this.dataValues = {}
this.__options = options
this.hasPrimaryKeys = options.hasPrimaryKeys
this.selectedValues = values
......@@ -46,7 +46,10 @@ module.exports = (function() {
, self = this
this.attributes.concat(this.__eagerlyLoadedAssociations).forEach(function(attr) {
result[attr] = self.dataValues[attr]
result[attr] = self.dataValues.hasOwnProperty(attr)
? self.dataValues[attr]
: self[attr]
;
})
return result
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!