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

Commit 21fbae6d by Jan Aagaard Meier

Only remove optClone from find, not findAll

1 parent a95bbc6f
Showing with 8 additions and 0 deletions
...@@ -325,6 +325,7 @@ module.exports = (function() { ...@@ -325,6 +325,7 @@ module.exports = (function() {
DAOFactory.prototype.findAll = function(options, queryOptions) { DAOFactory.prototype.findAll = function(options, queryOptions) {
var hasJoin = false var hasJoin = false
options = optClone(options)
if (typeof options === 'object') { if (typeof options === 'object') {
if (options.hasOwnProperty('include')) { if (options.hasOwnProperty('include')) {
hasJoin = true hasJoin = true
...@@ -806,6 +807,13 @@ module.exports = (function() { ...@@ -806,6 +807,13 @@ module.exports = (function() {
return attributes return attributes
} }
var optClone = function (options) {
return Utils._.cloneDeep(options, function (elem) {
// The DAOFactories used for include are pass by ref, so don't clone them. Otherwise return undefined, meaning, 'handle this lodash'
return elem instanceof DAOFactory ? elem : undefined
})
}
Utils._.extend(DAOFactory.prototype, require("./associations/mixin")) Utils._.extend(DAOFactory.prototype, require("./associations/mixin"))
return DAOFactory return DAOFactory
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!