[Vtigercrm-developers] How to correctly trigger CRMEntity->unlinkRelationship()?

Alan Lord alanslists at gmail.com
Wed Sep 26 13:29:32 GMT 2018

I have two custom modules which are related via the vtiger_crmentityrel 
table in a many-to-many style relationship.

I've been trying to trace through the vtiger code where the above 
function is ultimately triggered from and what I need to *configure* and 
where so that if I delete a record from either of the two modules, the 
relationship is cleared too?

The trash() function in CRMEntity fires unlinkDependencies(), but this 
seems to be for many-to-one relationships via UIType 10 fields.

The DeleteEntity() function in utils.php calls unlinkRelationship(), and 
this is called either by the Unlink action (expectedly) via the 
Vtiger_Relation_Model or from the Webservices/VtigerCRMObject.php class, 
but I do not think this is the right place either.

So after all this, am I right to think this is something I should take 
care of within a vtiger.entity.afterdelete event and that there isn;t a 
mechanism to get this triggered directly?

This is vtiger 7.1


More information about the vtigercrm-developers mailing list