Table of Contents Previous Next

Sugar Developer Guide

Version 5.1


Chapter 3 Module Framework : Vardefs : Relationships Array

Relationships Array
The relationships array is used to specify relationships between Beans. Like the Indices array entries, it is a list of names with array values.
The following example creates a reporting relationship between a contact and the person that they report to. The reports_to_id field is used to map to the id field in the contact of the person they report to. This is a one-to-many relationship in that each person is only allowed to report to one person. Each person is allowed to have an unlimited number of direct reports.
'contact_direct_reports' => array(
'lhs_module' => 'Contacts',
'lhs_table' => 'contacts',
'lhs_key' => 'id',
'rhs_module' => 'Contacts',
'rhs_table' => 'contacts',
'rhs_key' => 'reports_to_id',
'relationship_type' => 'one-to-many'),

Table of Contents Previous Next

Copyright 2004-2008 SugarCRM Inc.
Product License