cleaned some old comments
This commit is contained in:
parent
708265df22
commit
6db1a003d4
|
@ -424,14 +424,6 @@ AbstractClass.include = function (objects, include, callback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
async.parallel(callbacks, function(err, results) {
|
|
||||||
callback(null, objs);
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
||||||
function processIncludeJoin(ij) {
|
function processIncludeJoin(ij) {
|
||||||
if (typeof ij === 'string') {
|
if (typeof ij === 'string') {
|
||||||
ij = [ij];
|
ij = [ij];
|
||||||
|
@ -525,64 +517,6 @@ AbstractClass.include = function (objects, include, callback) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
function processIncludeItem(model, objs, include, keyVals, objsByKeys) {
|
|
||||||
var relations = model.relations;
|
|
||||||
|
|
||||||
if (include.constructor.name === 'Object') {
|
|
||||||
var relationName = Object.keys(include)[0];
|
|
||||||
var relation = relations[relationName];
|
|
||||||
var subInclude = include[relationName];
|
|
||||||
} else {
|
|
||||||
var relationName = include;
|
|
||||||
var relation = relations[relationName];
|
|
||||||
var subInclude = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
var req = {'where': {}};
|
|
||||||
if (!keyVals[relation.keyFrom]) {
|
|
||||||
objsByKeys[relation.keyFrom] = {};
|
|
||||||
for (var j = 0; j < objs.length; j++) {
|
|
||||||
if (!objsByKeys[relation.keyFrom][objs[j][relation.keyFrom]]) {
|
|
||||||
objsByKeys[relation.keyFrom][objs[j][relation.keyFrom]] = [];
|
|
||||||
}
|
|
||||||
objsByKeys[relation.keyFrom][objs[j][relation.keyFrom]].push(objs[j]);
|
|
||||||
}
|
|
||||||
keyVals[relation.keyFrom] = Object.keys(objsByKeys[relation.keyFrom]);
|
|
||||||
}
|
|
||||||
req['where'][relation.keyTo] = {inq: keyVals[relation.keyFrom]};
|
|
||||||
req['include'] = subInclude;
|
|
||||||
return function(cb) {
|
|
||||||
relation.model.all(req, function(err, dataIncluded) {
|
|
||||||
|
|
||||||
var objsIncluded = dataIncluded.map(function (obj) {
|
|
||||||
return self.fromDatabase(relation.model.modelName, obj);
|
|
||||||
});
|
|
||||||
|
|
||||||
for (var i = 0; i < objsIncluded.length; i++) {
|
|
||||||
var objectsFrom = objsByKeys[relation.keyFrom][objsIncluded[i][relation.keyTo]];
|
|
||||||
for (var j = 0; j < objectsFrom.length; j++) {
|
|
||||||
if (!objectsFrom[j].__cache) {
|
|
||||||
objectsFrom[j].__cache = {};
|
|
||||||
}
|
|
||||||
if (relation.type == 'hasMany') {
|
|
||||||
if (!objectsFrom[j].__cache[relationName]) {
|
|
||||||
objectsFrom[j].__cache[relationName] = [];
|
|
||||||
}
|
|
||||||
objectsFrom[j].__cache[relationName].push(objsIncluded[i]);
|
|
||||||
} else {
|
|
||||||
objectsFrom[j].__cache[relationName] = objsIncluded[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cb(err, dataIncluded);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue