data/Relationships/One2OneBeanRelationship.php

Show: inherited
Table of Contents

\One2OneBeanRelationship

Package: SugarCRM

1-1 Bean relationship

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)
\One2MBeanRelationship < \One2MRelationship < \M2MRelationship < \SugarRelationship
Api
 

Properties

Propertypublic  $type= '"one-to-many"'
inheritedInherited from: \One2MBeanRelationship::$$type
Default value"one-to-many"Details
Type
n/a
Inherited_from
\One2MBeanRelationship::$$type  

Methods

methodpublic__construct(  $def ) : void

Parameters
Name Type Description
$def
methodpublic__get(  $name ) : void
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
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
methodprotectedaddSelfReferencing(  $lhs,  $rhs, array $additionalFields = array() ) : void
inherited

Just overriding the function from M2M to prevent it from occuring

Inherited from: \One2MRelationship::addSelfReferencing()\One2MBeanRelationship::addSelfReferencing()

The logic for dealing with adding self-referencing one-to-many relations is in the add() method

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()\M2MRelationship::addToResaveList()\One2MRelationship::addToResaveList()\One2MBeanRelationship::addToResaveList()
Parameters
Name Type Description
$bean \SugarBean
Details
Static
 
methodprotectedcallAfterAdd( \SugarBean $focus, \SugarBean $related, string $link_name = "" ) : void
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
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
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
Returns
Type Description
String left link in relationship.
methodpublicgetLHSModule( ) : string
Returns
Type Description
string name of left hand side module.
methodpublicgetLinkedDefForModuleByRelationship(  $module ) : array | bool
Parameters
Name Type Description
$module
Returns
Type Description
array | bool
methodprotectedgetMostAppropriateLinkedDefinition(  $links ) : bool
inherited

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

Inherited from: \M2MRelationship::getMostAppropriateLinkedDefinition()\One2MRelationship::getMostAppropriateLinkedDefinition()\One2MBeanRelationship::getMostAppropriateLinkedDefinition()
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
inherited

Gets the query to load a link.

Inherited from: \One2MBeanRelationship::getQuery()

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
Returns
Type Description
String right link in relationship.
methodpublicgetRHSModule( ) : string
Returns
Type Description
string name of right hand side module.
methodpublicgetRelationshipTable( ) : string
Returns
Type Description
string name of the table for this relationship
methodprotectedgetRoleWhere( string $table = "",  $ignore_role_filter = false ) : string
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
inherited

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

Inherited from: \One2MBeanRelationship::getSubpanelQuery()
Parameters
Name Type Description
$link
$params array
$return_array bool
Returns
Type Description
String | Array
methodpublicisParentRelationship( ) : bool
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
inherited

Inherited from: \One2MBeanRelationship::load()
Parameters
Name Type Description
$link \$link

Link2 loads the relationship for this link.

$params
methodpublicrelationship_exists( \SugarBean $lhs, \SugarBean $rhs ) : boolean
inherited

Check to see if the relationship already exist.

Inherited from: \One2MBeanRelationship::relationship_exists()

If it does return true otherwise return false

Parameters
Name Type Description
$lhs \SugarBean

Left hand side of the relationship

$rhs \SugarBean

Right hand side of the relationship

Returns
Type Description
boolean
methodpublicremove( \$lhs $lhs, \$rhs $rhs,  $save = true ) : boolean
inherited

Inherited from: \One2MBeanRelationship::remove()
Parameters
Name Type Description
$lhs \$lhs

SugarBean

$rhs \$rhs

SugarBean

$save
Returns
Type Description
boolean
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 it was successful, false if it was not
methodpublicremoveById( \$rowID $rowID ) : void
Parameters
Name Type Description
$rowID \$rowID

id of SugarBean to remove from the relationship

methodprotectedremoveRow( \$where $where ) : bool | resource
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
inherited

Just overriding the function from M2M to prevent it from occuring

Inherited from: \One2MRelationship::removeSelfReferencing()\One2MBeanRelationship::removeSelfReferencing()
Parameters
Name Type Description
$lhs
$rhs
$additionalFields array
methodprotectedupdateFields(  $lhs,  $rhs,  $additionalFields ) : void
inherited

Inherited from: \One2MBeanRelationship::updateFields()
Parameters
Name Type Description
$lhs
$rhs
$additionalFields
methodprotectedupdateLinks(  $lhs,  $lhsLinkName,  $rhs,  $rhsLinkName ) : void

Parameters
Name Type Description
$lhs
$lhsLinkName
$rhs
$rhsLinkName
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.