data/Relationships/M2MRelationship.php

Show: inherited
Table of Contents

\M2MRelationship

Package: SugarCRM

Represents a many to many relationship that is table based.

It contains at least two links. Each link represents a connection from one record to the records linked in this relationship. Links have a context(focus) bean while relationships do not.

Parent(s)
\SugarRelationship
Children
\One2MRelationship
\One2OneRelationship
\EmailAddressRelationship
Api
 

Properties

Propertyprotected  $beansToResave= 'array()'
staticinheritedInherited from: \SugarRelationship::$$beansToResave
Default valuearray()Details
Type
n/a
Inherited_from
\SugarRelationship::$$beansToResave  
Propertyprotected  $def= ''
inheritedInherited from: \SugarRelationship::$$def
Details
Type
n/a
Inherited_from
\SugarRelationship::$$def  
Propertyprotected  $ignore_role_filter= 'false'
inheritedInherited from: \SugarRelationship::$$ignore_role_filter
Default valuefalseDetails
Type
n/a
Inherited_from
\SugarRelationship::$$ignore_role_filter  
Propertyprotected  $lhsLink= ''
inheritedInherited from: \SugarRelationship::$$lhsLink
Details
Type
n/a
Inherited_from
\SugarRelationship::$$lhsLink  
Propertyprotected  $rhsLink= ''
inheritedInherited from: \SugarRelationship::$$rhsLink
Details
Type
n/a
Inherited_from
\SugarRelationship::$$rhsLink  
Propertyprotected  $self_referencing= 'false'
inheritedInherited from: \SugarRelationship::$$self_referencing
Default valuefalseDetails
Type
n/a
Inherited_from
\SugarRelationship::$$self_referencing  
Propertypublic  $type= '"many-to-many"'
Default value"many-to-many"Details
Type
n/a

Methods

methodpublic__construct(  $def ) : void

Parameters
Name Type Description
$def
methodpublic__get(  $name ) : void
inherited

Inherited from: \SugarRelationship::__get()
Parameters
Name Type Description
$name
methodpublicadd( \$lhs $lhs, \$rhs $rhs, \$additionalFields $additionalFields = array() ) : boolean

Parameters
Name Type Description
$lhs \$lhs

SugarBean left side bean to add to the relationship.

$rhs \$rhs

SugarBean right side bean to add to the relationship.

$additionalFields \$additionalFields

key=>value pairs of fields to save on the relationship

Returns
Type Description
boolean true if successful
methodprotectedaddRow( array $row ) : bool | void
inherited

Inherited from: \SugarRelationship::addRow()
Parameters
Name Type Description
$row array

values to be inserted into the relationship

Returns
Type Description
bool | void null if new row was inserted and true if an exesting row was updated
methodprotectedaddSelfReferencing(  $lhs,  $rhs, array $additionalFields = array() ) : void

Adds the reversed version of this relationship to the table so that it can be accessed from either side equally

Parameters
Name Type Description
$lhs
$rhs
$additionalFields array
methodpublicaddToResaveList( \SugarBean $bean ) : void
staticinherited

Adds a realted Bean to the list to be resaved along with the current bean.

Inherited from: \SugarRelationship::addToResaveList()
Parameters
Name Type Description
$bean \SugarBean
Details
Static
 
methodprotectedcallAfterAdd( \SugarBean $focus, \SugarBean $related, string $link_name = "" ) : void
inherited

Call the after add logic hook for a given link

Inherited from: \SugarRelationship::callAfterAdd()
Parameters
Name Type Description
$focus \SugarBean

base bean the hooks is triggered from

$related \SugarBean

bean being added/removed/updated from relationship

$link_name string

name of link being triggerd

methodprotectedcallAfterDelete( \SugarBean $focus, \SugarBean $related, string $link_name = "" ) : void
inherited

Inherited from: \SugarRelationship::callAfterDelete()
Parameters
Name Type Description
$focus \SugarBean
$related \SugarBean
$link_name string
methodprotectedcallBeforeAdd( \SugarBean $focus, \SugarBean $related, string $link_name = "" ) : void
inherited

Call the before add logic hook for a given link

Inherited from: \SugarRelationship::callBeforeAdd()
Parameters
Name Type Description
$focus \SugarBean

base bean the hooks is triggered from

$related \SugarBean

bean being added/removed/updated from relationship

$link_name string

name of link being triggerd

methodprotectedcallBeforeDelete( \SugarBean $focus, \SugarBean $related, string $link_name = "" ) : void
inherited

Inherited from: \SugarRelationship::callBeforeDelete()
Parameters
Name Type Description
$focus \SugarBean
$related \SugarBean
$link_name string
methodprotectedcheckExisting(  $row ) : array | bool
inherited

Checks for an existing row who's keys match the one passed in.

Inherited from: \SugarRelationship::checkExisting()
Parameters
Name Type Description
$row
Returns
Type Description
array | bool returns false if now row is found, otherwise the row is returned
methodprotectedgetAlternateKeyFields( ) : Array

Returns
Type Description
Array - set of fields that uniquely identify an entry in this relationship
methodprotectedgetCustomLogicArguments( \SugarBean $focus, \SugarBean $related, string $link_name ) : array
Parameters
Name Type Description
$focus \SugarBean

base bean the hooks is triggered from

$related \SugarBean

bean being added/removed/updated from relationship

$link_name string

name of link being triggerd

Returns
Type Description
array base arguments to pass to relationship logic hooks
methodpublicgetFields( ) : array

Returns
Type Description
array names of fields stored on the relationship
methodpublicgetJoin( \Link2 $link,  $params = array(),  $return_array = false ) : string | array

Parameters
Name Type Description
$link \Link2
$params
$return_array
Returns
Type Description
string | array the query to join against the related modules table for the given link.
methodpublicgetLHSLink( ) : String
inherited

Inherited from: \SugarRelationship::getLHSLink()
Returns
Type Description
String left link in relationship.
methodpublicgetLHSModule( ) : string
inherited

Inherited from: \SugarRelationship::getLHSModule()
Returns
Type Description
string name of left hand side module.
methodpublicgetLinkedDefForModuleByRelationship(  $module ) : array | bool

Find the link entry for a particular relationship and module.

Parameters
Name Type Description
$module
Returns
Type Description
array | bool
methodprotectedgetMostAppropriateLinkedDefinition(  $links ) : bool

Find the most 'appropriate' link entry for a relationship/module in which there are multiple link entries with the same relationship name.

Parameters
Name Type Description
$links
Returns
Type Description
bool
methodprotectedgetOptionalWhereClause( \$optional_array $optional_array ) : string
Parameters
Name Type Description
$optional_array \$optional_array

clause to add to the where query when populating this relationship. It should be in the

Returns
Type Description
string
methodpublicgetQuery( \$link $link,  $params = array() ) : string | array

Gets the query to load a link.

This is currently public, but should prob be made protected later. See Link2->getQuery

Parameters
Name Type Description
$link \$link

Link Object to get query for.

$params
Returns
Type Description
string | array query used to load this relationship
methodpublicgetRHSLink( ) : String
inherited

Inherited from: \SugarRelationship::getRHSLink()
Returns
Type Description
String right link in relationship.
methodpublicgetRHSModule( ) : string
inherited

Inherited from: \SugarRelationship::getRHSModule()
Returns
Type Description
string name of right hand side module.
methodpublicgetRelationshipTable( ) : string

Returns
Type Description
string name of the table for this relationship
methodprotectedgetRoleFilterForJoin( ) : void

methodprotectedgetRoleWhere( string $table = "",  $ignore_role_filter = false ) : string
inherited

Gets the relationship role column check for the where clause

Inherited from: \SugarRelationship::getRoleWhere()
Parameters
Name Type Description
$table string
$ignore_role_filter
Returns
Type Description
string
methodprotectedgetRowToInsert(  $lhs,  $rhs,  $additionalFields = array() ) : void

Parameters
Name Type Description
$lhs
$rhs
$additionalFields
methodpublicgetSubpanelQuery(  $link, array $params = array(), bool $return_array = false ) : String | Array

Similar to getQuery or Get join, except this time we are starting from the related table and searching for items with id's matching the $link->focus->id

Parameters
Name Type Description
$link
$params array
$return_array bool
Returns
Type Description
String | Array
methodpublicisParentRelationship( ) : bool
inherited

Inherited from: \SugarRelationship::isParentRelationship()
Returns
Type Description
bool true if the relationship is a flex / parent relationship
methodprotectedlinkIsLHS(  $link ) : void

Parameters
Name Type Description
$link
methodpublicload( \$link $link,  $params = array() ) : void

Parameters
Name Type Description
$link \$link

Link2 loads the relationship for this link.

$params
methodpublicrelationship_exists(  $lhs,  $rhs ) : bool

Parameters
Name Type Description
$lhs
$rhs
Returns
Type Description
bool
methodpublicremove( \$lhs $lhs, \$rhs $rhs ) : void

Parameters
Name Type Description
$lhs \$lhs

SugarBean

$rhs \$rhs

SugarBean

methodpublicremoveAll( \$link $link ) : void
inherited

Inherited from: \SugarRelationship::removeAll()
Parameters
Name Type Description
$link \$link

Link2 removes all the beans associated with this link from the relationship

methodpublicremoveById( \$rowID $rowID ) : void
inherited

Inherited from: \SugarRelationship::removeById()
Parameters
Name Type Description
$rowID \$rowID

id of SugarBean to remove from the relationship

methodprotectedremoveRow( \$where $where ) : bool | resource
inherited

Removes one or more rows from the relationship table

Inherited from: \SugarRelationship::removeRow()
Parameters
Name Type Description
$where \$where

array of field=>value pairs to match

Returns
Type Description
bool | resource
methodprotectedremoveSelfReferencing(  $lhs,  $rhs, array $additionalFields = array() ) : void

Removes the reversed version of this relationship

Parameters
Name Type Description
$lhs
$rhs
$additionalFields array
methodpublicresaveRelatedBeans( ) : void
staticinherited

Inherited from: \SugarRelationship::resaveRelatedBeans()
Details
Static
 
methodprotectedupdateRow( \$id $id, \$values $values ) : resource
inherited

Inherited from: \SugarRelationship::updateRow()
Parameters
Name Type Description
$id \$id

id of row to update

$values \$values

values to insert into row

Returns
Type Description
resource result of update satatement
Documentation was generated by DocBlox 0.18.1.