Fix inherit bug
This commit is contained in:
parent
2de55df939
commit
0aa0cabdd4
|
@ -120,24 +120,25 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// mix in EventEmitter
|
// mix in EventEmitter (dont inherit from)
|
||||||
var events = new EventEmitter();
|
var events = new EventEmitter();
|
||||||
ModelClass.on = events.on.bind(events);
|
ModelClass.on = events.on.bind(events);
|
||||||
ModelClass.once = events.once.bind(events);
|
ModelClass.once = events.once.bind(events);
|
||||||
ModelClass.emit = events.emit.bind(events);
|
ModelClass.emit = events.emit.bind(events);
|
||||||
|
ModelClass.setMaxListeners = events.setMaxListeners.bind(events);
|
||||||
|
|
||||||
hiddenProperty(ModelClass, 'schema', schema);
|
hiddenProperty(ModelClass, 'schema', schema);
|
||||||
hiddenProperty(ModelClass, 'modelName', className);
|
hiddenProperty(ModelClass, 'modelName', className);
|
||||||
hiddenProperty(ModelClass, 'pluralModelName', pluralName || i8n.pluralize(className));
|
hiddenProperty(ModelClass, 'pluralModelName', pluralName || i8n.pluralize(className));
|
||||||
hiddenProperty(ModelClass, 'relations', {});
|
hiddenProperty(ModelClass, 'relations', {});
|
||||||
|
|
||||||
// inherit ModelBaseClass methods
|
util.inherits(ModelClass, ModelBaseClass);
|
||||||
|
|
||||||
|
// inherit ModelBaseClass static methods
|
||||||
for (var i in ModelBaseClass) {
|
for (var i in ModelBaseClass) {
|
||||||
ModelClass[i] = ModelBaseClass[i];
|
ModelClass[i] = ModelBaseClass[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
util.inherits(ModelClass, ModelBaseClass);
|
|
||||||
|
|
||||||
ModelClass.getter = {};
|
ModelClass.getter = {};
|
||||||
ModelClass.setter = {};
|
ModelClass.setter = {};
|
||||||
standartize(properties, settings);
|
standartize(properties, settings);
|
||||||
|
|
Loading…
Reference in New Issue