diff --git a/packages/core/database/src/collection.ts b/packages/core/database/src/collection.ts index ceecfc848..eb9ed4b42 100644 --- a/packages/core/database/src/collection.ts +++ b/packages/core/database/src/collection.ts @@ -699,6 +699,17 @@ export class Collection< }; } + protected bindFieldEventListener() { + this.on('field.afterAdd', (field: Field) => { + field.bind(); + }); + + this.on('field.afterRemove', (field: Field) => { + field.unbind(); + this.db.emit('field.afterRemove', field); + }); + } + private checkOptions(options: CollectionOptions) { checkIdentifier(options.name); this.checkTableName(); @@ -716,15 +727,4 @@ export class Collection< } } } - - private bindFieldEventListener() { - this.on('field.afterAdd', (field: Field) => { - field.bind(); - }); - - this.on('field.afterRemove', (field: Field) => { - field.unbind(); - this.db.emit('field.afterRemove', field); - }); - } }