MCPcopy Create free account
hub / github.com/dresende/node-orm2 / _saveManyAssociation

Function _saveManyAssociation

lib/Instance.js:322–335  ·  view source on GitHub ↗
(assoc)

Source from the content-addressed store, hash-verified

320
321
322 var _saveManyAssociation = function (assoc) {
323 var assocVal = instance[assoc.name];
324
325 if (!Array.isArray(assocVal)) return;
326 if (!opts.associations[assoc.name].changed) return;
327
328 for (j = 0; j < assocVal.length; j++) {
329 if (!assocVal[j].isInstance) {
330 assocVal[j] = new assoc.model(assocVal[j]);
331 }
332 }
333
334 saveAssociation(assoc.setAccessor, assocVal);
335 };
336
337 for (i = 0; i < opts.many_associations.length; i++) {
338 _saveManyAssociation(opts.many_associations[i]);

Callers 1

saveAssociationsFunction · 0.85

Calls 1

saveAssociationFunction · 0.70

Tested by

no test coverage detected