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

Commit bd1279d3 by Sascha Depold

methods for checking for stored associations + getter and setter

1 parent 82120c5d
Showing with 11 additions and 3 deletions
...@@ -105,7 +105,7 @@ exports.SequelizeTable = function(Sequelize, sequelize, tableName, attributes, o ...@@ -105,7 +105,7 @@ exports.SequelizeTable = function(Sequelize, sequelize, tableName, attributes, o
findAll: function(options, callback) { findAll: function(options, callback) {
// use the first param as callback if it is no object (hash) // use the first param as callback if it is no object (hash)
var _callback = (typeof options == 'object') ? callback : options var _callback = ((typeof options == 'function') ? options : callback)
var queryOptions = (typeof options == 'object') var queryOptions = (typeof options == 'object')
? Sequelize.Helper.Hash.merge(options, { table: table.tableName }) ? Sequelize.Helper.Hash.merge(options, { table: table.tableName })
: { table: table.tableName } : { table: table.tableName }
...@@ -129,7 +129,7 @@ exports.SequelizeTable = function(Sequelize, sequelize, tableName, attributes, o ...@@ -129,7 +129,7 @@ exports.SequelizeTable = function(Sequelize, sequelize, tableName, attributes, o
find: function(conditions, options, callback) { find: function(conditions, options, callback) {
// use the second param as callback if it is no object (hash) // use the second param as callback if it is no object (hash)
var _callback = (typeof options == 'object') ? callback : options var _callback = ((typeof options == 'object') ? callback : options)
sequelize.query( sequelize.query(
Sequelize.sqlQueryFor('select', { Sequelize.sqlQueryFor('select', {
...@@ -325,7 +325,15 @@ exports.SequelizeTable = function(Sequelize, sequelize, tableName, attributes, o ...@@ -325,7 +325,15 @@ exports.SequelizeTable = function(Sequelize, sequelize, tableName, attributes, o
}, },
hasFetchedAssociationFor: function(assocName) { hasFetchedAssociationFor: function(assocName) {
return this.fetchedAssociations && this.fetchedAssociations[assocName] return (this.fetchedAssociations && this.fetchedAssociations[assocName])
},
setAssociationDataFor: function(assocName, data) {
this.fetchedAssociations[assocName] = data
},
getAssociationDataFor: function(assocName) {
return this.fetchedAssociations[assocName]
}, },
save: function(callback) { save: function(callback) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!