diff --git a/packages/api-page-builder/src/plugins/models/pbCategory.model.ts b/packages/api-page-builder/src/plugins/models/pbCategory.model.ts index 90968005485..d0fe9d4b4fe 100644 --- a/packages/api-page-builder/src/plugins/models/pbCategory.model.ts +++ b/packages/api-page-builder/src/plugins/models/pbCategory.model.ts @@ -11,7 +11,7 @@ export default ({ createBase, context }) => withName("PbCategory"), withHooks({ async beforeDelete() { - const { PbPage } = context.models[this.modelId]; + const { PbPage } = context.models; if (await PbPage.findOne()) { throw new Error( "Cannot delete category because some pages are linked to it."