diff --git a/lib/model-builder.js b/lib/model-builder.js index c622e45e..8b3beb91 100644 --- a/lib/model-builder.js +++ b/lib/model-builder.js @@ -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(); ModelClass.on = events.on.bind(events); ModelClass.once = events.once.bind(events); ModelClass.emit = events.emit.bind(events); + ModelClass.setMaxListeners = events.setMaxListeners.bind(events); hiddenProperty(ModelClass, 'schema', schema); hiddenProperty(ModelClass, 'modelName', className); hiddenProperty(ModelClass, 'pluralModelName', pluralName || i8n.pluralize(className)); hiddenProperty(ModelClass, 'relations', {}); + + util.inherits(ModelClass, ModelBaseClass); - // inherit ModelBaseClass methods + // inherit ModelBaseClass static methods for (var i in ModelBaseClass) { ModelClass[i] = ModelBaseClass[i]; } - util.inherits(ModelClass, ModelBaseClass); - ModelClass.getter = {}; ModelClass.setter = {}; standartize(properties, settings);