Fix prototype access issue with model scopes property
continuous-integration/drone/push Build is passing Details

orm-types
Garrett Mills 2 years ago
parent d245d15ad6
commit 50e0cf3090

@ -194,7 +194,15 @@ export abstract class Model<T extends Model<T>> extends AppClass implements Bus
}
}
builder.withScopes(this.prototype.scopes)
if ( this.prototype.scopes ) {
// Same thing here. Try to get the scopes statically, if possible
builder.withScopes(this.prototype.scopes)
} else if ( this.constructor.length < 1 ) {
// Otherwise, try to instantiate the model if possible and load the scopes that way
const inst = Container.getContainer().make<Model<any>>(this)
builder.withScopes(inst.scopes)
}
return builder
}

Loading…
Cancel
Save