[Vtigercrm-developers] Relation Model getAllRelations()?

Alan Lord alanslists at gmail.com
Fri Oct 10 13:13:01 GMT 2014


I'm investigating building a new module and would like to be able to 
retrieve all the relationships from one module to others:

I found the getAllRelations() function which I can call from the 
ModuleModel->getRelations() but it only seems to show the related lists 
(1:n & n:n relationships) and not the UI10 relationships in this module. 
(See below for the model returned for the Contacts module and note that 
the Account relationship is missing).

Is there a way to get *all* the relationships in a single function or 
will I have to write one?

> Array
> (
>     [0] => Vtiger_Relation_Model Object
>         (
>             [parentModule:protected] => Contacts_Module_Model Object
>                 (
>                     [blocks:protected] =>
>                     [nameFields:protected] =>
>                     [moduleMeta:protected] =>
>                     [fields:protected] =>
>                     [relations:protected] =>
>                     [id] => 4
>                     [name] => Contacts
>                     [label] => Contacts
>                     [version] =>
>                     [minversion] =>
>                     [maxversion] =>
>                     [presence] => 0
>                     [ownedby] => 0
>                     [tabsequence] => 4
>                     [parent] => Sales
>                     [customized] => 0
>                     [trial] => 0
>                     [isentitytype] => 1
>                     [entityidcolumn] =>
>                     [entityidfield] =>
>                     [basetable] => vtiger_contactdetails
>                     [basetableid] => contactid
>                     [customtable] =>
>                     [grouptable] =>
>                 )
>
>             [relatedModule:protected] =>
>             [relationType:protected] =>
>             [valueMap:protected] => Array
>                 (
>                     [0] => 19
>                     [relation_id] => 19
>                     [1] => 4
>                     [tabid] => 4
>                     [2] => 9
>                     [related_tabid] => 9
>                     [3] => get_activities
>                     [name] => get_activities
>                     [4] => 2
>                     [sequence] => 2
>                     [5] => Activities
>                     [label] => Activities
>                     [6] => 0
>                     [presence] => 0
>                     [7] => add
>                     [actions] => add
>                     [8] => Calendar
>                     [modulename] => Calendar
>                     [relatedModuleName] => Calendar
>                 )
>
>         )
>
>     [1] => Vtiger_Relation_Model Object
>         (
>             [parentModule:protected] => Contacts_Module_Model Object
>                 (
>                     [blocks:protected] =>
>                     [nameFields:protected] =>
>                     [moduleMeta:protected] =>
>                     [fields:protected] =>
>                     [relations:protected] =>
>                     [id] => 4
>                     [name] => Contacts
>                     [label] => Contacts
>                     [version] =>
>                     [minversion] =>
>                     [maxversion] =>
>                     [presence] => 0
>                     [ownedby] => 0
>                     [tabsequence] => 4
>                     [parent] => Sales
>                     [customized] => 0
>                     [trial] => 0
>                     [isentitytype] => 1
>                     [entityidcolumn] =>
>                     [entityidfield] =>
>                     [basetable] => vtiger_contactdetails
>                     [basetableid] => contactid
>                     [customtable] =>
>                     [grouptable] =>
>                 )
>
>             [relatedModule:protected] =>
>             [relationType:protected] =>
>             [valueMap:protected] => Array
>                 (
>                     [0] => 20
>                     [relation_id] => 20
>                     [1] => 4
>                     [tabid] => 4
>                     [2] => 10
>                     [related_tabid] => 10
>                     [3] => get_emails
>                     [name] => get_emails
>                     [4] => 3
>                     [sequence] => 3
>                     [5] => Emails
>                     [label] => Emails
>                     [6] => 0
>                     [presence] => 0
>                     [7] => add
>                     [actions] => add
>                     [8] => Emails
>                     [modulename] => Emails
>                     [relatedModuleName] => Emails
>                 )
>
>         )
>
>     [2] => Vtiger_Relation_Model Object
>         (
>             [parentModule:protected] => Contacts_Module_Model Object
>                 (
>                     [blocks:protected] =>
>                     [nameFields:protected] =>
>                     [moduleMeta:protected] =>
>                     [fields:protected] =>
>                     [relations:protected] =>
>                     [id] => 4
>                     [name] => Contacts
>                     [label] => Contacts
>                     [version] =>
>                     [minversion] =>
>                     [maxversion] =>
>                     [presence] => 0
>                     [ownedby] => 0
>                     [tabsequence] => 4
>                     [parent] => Sales
>                     [customized] => 0
>                     [trial] => 0
>                     [isentitytype] => 1
>                     [entityidcolumn] =>
>                     [entityidfield] =>
>                     [basetable] => vtiger_contactdetails
>                     [basetableid] => contactid
>                     [customtable] =>
>                     [grouptable] =>
>                 )
>
>             [relatedModule:protected] =>
>             [relationType:protected] =>
>             [valueMap:protected] => Array
>                 (
>                     [0] => 27
>                     [relation_id] => 27
>                     [1] => 4
>                     [tabid] => 4
>                     [2] => 8
>                     [related_tabid] => 8
>                     [3] => get_attachments
>                     [name] => get_attachments
>                     [4] => 10
>                     [sequence] => 10
>                     [5] => Documents
>                     [label] => Documents
>                     [6] => 0
>                     [presence] => 0
>                     [7] => add,select
>                     [actions] => add,select
>                     [8] => Documents
>                     [modulename] => Documents
>                     [relatedModuleName] => Documents
>                 )
>
>         )
>
>     [3] => Vtiger_Relation_Model Object
>         (
>             [parentModule:protected] => Contacts_Module_Model Object
>                 (
>                     [blocks:protected] =>
>                     [nameFields:protected] =>
>                     [moduleMeta:protected] =>
>                     [fields:protected] =>
>                     [relations:protected] =>
>                     [id] => 4
>                     [name] => Contacts
>                     [label] => Contacts
>                     [version] =>
>                     [minversion] =>
>                     [maxversion] =>
>                     [presence] => 0
>                     [ownedby] => 0
>                     [tabsequence] => 4
>                     [parent] => Sales
>                     [customized] => 0
>                     [trial] => 0
>                     [isentitytype] => 1
>                     [entityidcolumn] =>
>                     [entityidfield] =>
>                     [basetable] => vtiger_contactdetails
>                     [basetableid] => contactid
>                     [customtable] =>
>                     [grouptable] =>
>                 )
>
>             [relatedModule:protected] =>
>             [relationType:protected] =>
>             [valueMap:protected] => Array
>                 (
>                     [0] => 155
>                     [relation_id] => 155
>                     [1] => 4
>                     [tabid] => 4
>                     [2] => 50
>                     [related_tabid] => 50
>                     [3] => get_dependents_list
>                     [name] => get_dependents_list
>                     [4] => 17
>                     [sequence] => 17
>                     [5] => Tour Families
>                     [label] => Tour Families
>                     [6] => 0
>                     [presence] => 0
>                     [7] => ADD
>                     [actions] => ADD
>                     [8] => LSTourFamilies
>                     [modulename] => LSTourFamilies
>                     [relatedModuleName] => LSTourFamilies
>                 )
>
>         )
>
>     [4] => Vtiger_Relation_Model Object
>         (
>             [parentModule:protected] => Contacts_Module_Model Object
>                 (
>                     [blocks:protected] =>
>                     [nameFields:protected] =>
>                     [moduleMeta:protected] =>
>                     [fields:protected] =>
>                     [relations:protected] =>
>                     [id] => 4
>                     [name] => Contacts
>                     [label] => Contacts
>                     [version] =>
>                     [minversion] =>
>                     [maxversion] =>
>                     [presence] => 0
>                     [ownedby] => 0
>                     [tabsequence] => 4
>                     [parent] => Sales
>                     [customized] => 0
>                     [trial] => 0
>                     [isentitytype] => 1
>                     [entityidcolumn] =>
>                     [entityidfield] =>
>                     [basetable] => vtiger_contactdetails
>                     [basetableid] => contactid
>                     [customtable] =>
>                     [grouptable] =>
>                 )
>
>             [relatedModule:protected] =>
>             [relationType:protected] =>
>             [valueMap:protected] => Array
>                 (
>                     [0] => 156
>                     [relation_id] => 156
>                     [1] => 4
>                     [tabid] => 4
>                     [2] => 51
>                     [related_tabid] => 51
>                     [3] => get_dependents_list
>                     [name] => get_dependents_list
>                     [4] => 18
>                     [sequence] => 18
>                     [5] => Tour Details
>                     [label] => Tour Details
>                     [6] => 0
>                     [presence] => 0
>                     [7] => ADD
>                     [actions] => ADD
>                     [8] => LSTourDetails
>                     [modulename] => LSTourDetails
>                     [relatedModuleName] => LSTourDetails
>                 )
>
>         )
>
> )




More information about the vtigercrm-developers mailing list