Fix inheritance

This commit is contained in:
Anatoliy Chakkaev 2012-10-22 17:33:57 +04:00
parent e6be50eb81
commit c27a624d02
3 changed files with 11 additions and 7 deletions

View File

@ -106,9 +106,6 @@ AbstractClass.prototype._initProperties = function (data, applySetters) {
this.trigger("initialize");
}
AbstractClass.setter = {};
AbstractClass.getter = {};
/**
* @param {String} prop - property name
* @param {Object} params - various property configuration

View File

@ -158,9 +158,16 @@ Schema.prototype.define = function defineClass(className, properties, settings)
hiddenProperty(NewClass, 'cache', {});
hiddenProperty(NewClass, 'mru', []);
// setup inheritance
NewClass.__proto__ = AbstractClass;
util.inherits(NewClass, AbstractClass);
// inherit AbstractClass methods
for (var i in AbstractClass) {
NewClass[i] = AbstractClass[i];
}
for (var j in AbstractClass.prototype) {
NewClass.prototype[j] = AbstractClass.prototype[j];
}
NewClass.getter = {};
NewClass.setter = {};
// store class in model pool
this.models[className] = NewClass;

View File

@ -1,7 +1,7 @@
{
"name": "jugglingdb",
"description": "ORM for every database: redis, mysql, neo4j, mongodb, postgres, sqlite",
"version": "0.1.24-pre",
"version": "0.1.24-pre2",
"author": "Anatoliy Chakkaev <rpm1602@gmail.com>",
"contributors": [
{ "name": "Anatoliy Chakkaev", "email": "rpm1602@gmail.com" },