Reputation: 3592
I have 2 models, usergroups and usergrouppermissions. my usergrouppermissions has a field called user_group_id which links back to the main usergroup. In a case where I want to delete the user group, I automatically want it to delete the entry in the database for usergrouppermissions (as the user group wont exist) anymore. I have tried delete, however, it just deletes the usergroup.
// Here is my model: (usergroup):
public $hasMany = array(
'UserGroupPermission'
);
// Here is the usergrouppermissions model:
public $belongsTo = array(
"UserGroup"
);
Upvotes: 1
Views: 2793