after_relationship_add triggers after_relationship_delete

Hi there

I have these two logic hooks in a file called ContactLogicHook.php

$hook_array['after_relationship_add'] = Array();
$hook_array['after_relationship_add'][] = Array(1, 'Contact', 'modules/Contacts/ContactLogicHook.php' ,'ContactLogic', 'addContactCourse');

$hook_array['after_relationship_delete'] = Array();
$hook_array['after_relationship_delete'][] = Array(1, 'Contact', 'modules/Contacts/ContactLogicHook.php' ,'ContactLogic', 'removeContactCourse'); 

This is the problem I am experiencing. When I ADD a relationship, and it triggers after_relationship_add and the method “addContactCourse” the logic hook after_relationship_delete is ALSO being fied, and runs code to remove the relationship for ALL other contacts who has the same relationship.

Any ideas?

I think the issue is the way your code is structured. You should put a flag that takes care of exceptions.

Thanks,

AlxGr