data/Relationships/SugarRelationship.php

Show: inherited
Table of Contents

Constants

Constant  REL_LHS = 'LHS'
Constant  REL_RHS = 'RHS'
Constant  REL_BOTH = 'BOTH_SIDES'
Constant  REL_MANY_MANY = 'many-to-many'
Constant  REL_ONE_MANY = 'one-to-many'
Constant  REL_ONE_ONE = 'one-to-one'

\SugarRelationship

Package: SugarCRM

A relationship is between two modules.

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.

Children
\M2MRelationship
Api
 

Properties

Propertyprotected  $beansToResave= 'array()'
static
Default valuearray()Details
Type
n/a
Propertyprotected  $def= ''
Details
Type
n/a
Propertyprotected  $ignore_role_filter= 'false'
Default valuefalseDetails
Type
n/a
Propertyprotected  $lhsLink= ''
Details
Type
n/a
Propertyprotected  $rhsLink= ''
Details
Type
n/a
Propertyprotected  $self_referencing= 'false'
Default valuefalseDetails
Type
n/a

Methods

methodpublic__get(  $name ) : void

Parameters
Name Type Description
$name
methodpublicadd(  $lhs,  $rhs,  $additionalFields = array() ) : void
abstract

Parameters
Name Type Description
$lhs
$rhs
$additionalFields
methodprotectedaddRow( array $row ) : bool | void

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 existing row was updated
methodpublicaddToResaveList( \SugarBean $bean ) : void
static

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

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

Call the after add logic hook for a given link

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

Parameters
Name Type Description
$focus \SugarBean
$related \SugarBean
$link_name string
methodprotectedcallBeforeAdd( \SugarBean $focus, \SugarBean $related, string $link_name = "" ) : void

Call the before add logic hook for a given link

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

Parameters
Name Type Description
$focus \SugarBean
$related \SugarBean
$link_name string
methodprotectedcheckExisting(  $row ) : array | bool

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

Parameters
Name Type Description
$row
Returns
Type Description
array | bool returns false if now row is found, otherwise the row is returned
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 ) : string | array
abstract

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

Returns
Type Description
String left link in relationship.
methodpublicgetLHSModule( ) : string

Returns
Type Description
string name of left hand side module.
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
abstract

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
Details
Abstract
 
methodpublicgetRHSLink( ) : String

Returns
Type Description
String right link in relationship.
methodpublicgetRHSModule( ) : string

Returns
Type Description
string name of right hand side module.
methodpublicgetRelationshipTable( ) : string
abstract

Returns
Type Description
string name of the table for this relationship
Details
Abstract
 
methodprotectedgetRoleWhere( string $table = "",  $ignore_role_filter = false ) : string

Gets the relationship role column check for the where clause

Parameters
Name Type Description
$table string
$ignore_role_filter
Returns
Type Description
string
methodpublicisParentRelationship( ) : bool

Returns
Type Description
bool true if the relationship is a flex / parent relationship
methodpublicload( \$link $link,  $params = array() ) : void
abstract

Parameters
Name Type Description
$link \$link

Link2 loads the rows for this relationship that match the given link

$params
Details
Abstract
 
methodpublicrelationship_exists( \SugarBean $lhs, \SugarBean $rhs ) : bool
abstract

Parameters
Name Type Description
$lhs \SugarBean
$rhs \SugarBean
Returns
Type Description
bool
Details
Abstract
 
methodpublicremove( \$lhs $lhs, \$rhs $rhs ) : boolean
abstract

Parameters
Name Type Description
$lhs \$lhs

SugarBean

$rhs \$rhs

SugarBean

Returns
Type Description
boolean
Details
Abstract
 
methodpublicremoveAll( \$link $link ) : boolean

Parameters
Name Type Description
$link \$link

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

Returns
Type Description
boolean true if all beans were successfully removed or there were not related beans, false otherwise
methodpublicremoveById( \$rowID $rowID ) : void

Parameters
Name Type Description
$rowID \$rowID

id of SugarBean to remove from the relationship

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

Removes one or more rows from the relationship table

Parameters
Name Type Description
$where \$where

array of field=>value pairs to match

Returns
Type Description
bool | resource
methodpublicresaveRelatedBeans( ) : void
static

Details
Static
 
methodprotectedupdateRow( \$id $id, \$values $values ) : resource

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.