models.forEach(function (model) { tasks.push(app.series.bind(app, 'model:load', model)); model._relatedColumns.forEach(function (col) { if (typeof model[col] != 'undefined') { tasks.push(app.series.bind(app, 'model:load', model[col])); } }); });
stream.on('result', function (row) { var model = ModelClass.createFromQuery(row); var tasks = []; tasks.push(app.series.bind(app, 'model:load', model)); model._relatedColumns.forEach(function (col) { if (typeof model[col] != 'undefined') { tasks.push(app.series.bind(app, 'model:load', model[col])); } }); app.utils.async.parallel(tasks, function (err) { if (err) return app.emit('error', err); stream.emit('model', model); }); });