Recognize what type of relationship is added in after_relationship_add logic hook

Hi folks,

I have multiple relationships related to a custom module. I’m trying to handle adding of relationship by adding after_relationship_add logic hook for my module. For example, they can be Orders, Accounts, Transactions.

Question: How can I recognize what type of relationship was added when catching this event in a logic hook? How can I handle adding of Order relationship but ignore adding of Account or Transaction?

Thanks in advance.

Have you tried examining the parameters received in the hook?

function after_relationship_add($bean, $event, $arguments){}
1 Like


You have access to $arguments[‘related_module’]

I get an empty string in $arguments

Also, $event is after_save instead of after_relationship_add :confused:

I double-checked my logic hook, it has only one hook after_relationship_add

Sorry guys, all good, it was a file permissions issue, that’s why logichooks.ext.php was not updated.