Cascade DELETE priority

Hi, is there any priority how are cascade effect is called ? Currently I've two hasMany relations where you have tree structure for categories and each category got items. When you delete the category, all child categories will be deleted however before category is deleted, all items in category need to be deleted too. Both tables got foreign keys. Is there any solution or shall I delete items in beforeDelete event?

Do your database tables have cascading deletion set up? If so, the database should take care of everything.

It seems like that if primary table uses soft delete, the cascade won't effect.