Thanks a lot for your detailed explanation. I will check the debugging soon.
For my example code: Yes this is a model with publishing enabled. After your feedback I tried the following code and it seems to work:
async beforeUpdate(params, data) {
if(data.published_at && !data.title) {
const article = await strapi.query('article').find({id: params.id});
if(article[0].article_category === undefined || article[0].article_category === null) {
throw new Error('Entity is required!');
}
}
else if(!data.published_at && data.title) {
if(data.article_category === undefined || data.article_category === null) {
throw new Error('Entity is required!');
}
}
},
Or do you see any mistake in it?
Thanks for your help!