Skip to content

Instantly share code, notes, and snippets.

@smalyshev
Created February 2, 2011 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smalyshev/807115 to your computer and use it in GitHub Desktop.
Save smalyshev/807115 to your computer and use it in GitHub Desktop.
<?php
'relationships' => array(
/* regular one-to-many */
'contact_direct_reports' => array(
'left' => array('module' => 'Contacts', 'link' => 'reports_to_link'),
'right' => array('module' => 'Contacts', 'link' => 'direct_reports'),
),
/* one-to-many with fields */
'accounts_contacts' => array(
'left' => array('module' => 'Accounts', 'id' = 'account_id', 'link' => 'contacts'),
'right' => array('module' => 'Contacts', 'id' = 'contact_id', 'link' => 'accounts'),
'fields' => array(
'id'=>array('type'=>'id'),
'contact_role'=> array('type'=>'varchar'),
)
),
/* many-to-many */
'contacts_opportunties'=> array(
'left'=>array('module'=>'Opportunities', 'id'=>'opportunity_id', 'link' => 'contacts'),
'right'=>array('module'=>'Contacts', 'id'=>'contact_id', 'link' => 'opportunities'),
'fields'= array(
'id'=>array('type'=>'id'),
'contact_role'=> array('type'=>'varchar'),
),
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment