Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

"session" not set for memory store #61

Closed
jvpoucke opened this Issue · 1 comment

2 participants

@jvpoucke

Code in persistence.store.memory.js should be:
persistence.flush = function (tx, callback) {
var args = argspec.getArgs(arguments, [
{ name: "tx", optional: true, check: persistence.isTransaction },
{ name: "callback", optional: true, check: argspec.isCallback(), defaultValue: function(){} }
]);

var session = this; /*<------ bugfix ---*/
var fns = persistence.flushHooks;
persistence.asyncForEach(fns, function(fn, callback) {
    fn(session, tx, callback); /*<------ else session in undefined here ---*/
  }, function() {
    var trackedObjects = persistence.trackedObjects;
    for(var id in trackedObjects) {
      if(trackedObjects.hasOwnProperty(id)) {
        if (persistence.objectsToRemove.hasOwnProperty(id)) {
          delete trackedObjects[id];
        } else {
          trackedObjects[id]._dirtyProperties = {};
        }
      }
    }
    args.callback();
  });

};

@zefhemel
Collaborator

Fixed. Thanks!

@zefhemel zefhemel closed this
@TheCodeDestroyer TheCodeDestroyer referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@TheCodeDestroyer TheCodeDestroyer referenced this issue from a commit in ormjs/orm.js-legacy
@zefhemel zefhemel Fixes: coresmart/persistencejs#61 e885b46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.