data/Relationships/One2OneRelationship.php

Show: inherited
Table of Contents

\One2OneRelationship

Package: SugarCRM

Represents 1-1 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)
\M2MRelationship < \SugarRelationship
Api
 

Properties

Propertyprotected  $beansToResave= 'array()'
Default valuearray()Details
Type
n/a
Inherited_from
\SugarRelationship::$$beansToResave  
Inherited_from
\M2MRelationship::$$beansToResave  
Propertyprotected  $def= ''
Details
Type
n/a
Inherited_from
\SugarRelationship::$$def  
Inherited_from
\M2MRelationship::$$def  
Propertyprotected  $ignore_role_filter= 'false'
Default valuefalseDetails
Type
n/a
Inherited_from
\SugarRelationship::$$ignore_role_filter  
Inherited_from
\M2MRelationship::$$ignore_role_filter  
Propertyprotected  $lhsLink= ''
Details
Type
n/a
Inherited_from
\SugarRelationship::$$lhsLink  
Inherited_from
\M2MRelationship::$$lhsLink  
Propertyprotected  $rhsLink= ''
Details
Type
n/a
Inherited_from
\SugarRelationship::$$rhsLink  
Inherited_from
\M2MRelationship::$$rhsLink  
Propertyprotected  $self_referencing= 'false'
Default valuefalseDetails
Type
n/a
Inherited_from
\SugarRelationship::$$self_referencing  
Inherited_from
\M2MRelationship::$$self_referencing  
Propertypublic  $type= '"many-to-many"'
inheritedInherited from: \M2MRelationship::$$type
Default value"many-to-many"Details
Type
n/a
Inherited_from
\M2MRelationship::$$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

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

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

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

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

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

Find the link entry for a particular relationship and module.

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

Inherited from: \M2MRelationship::getRelationshipTable()
Returns
Type Description
string name of the table for this relationship
methodprotectedgetRoleFilterForJoin( ) : void
inherited

Inherited from: \M2MRelationship::getRoleFilterForJoin()
methodprotectedgetRoleWhere( string $table = "",  $ignore_role_filter = false ) : string
inherited

Gets the relationship role column check for the where clause

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

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

Inherited from: \M2MRelationship::linkIsLHS()
Parameters
Name Type Description
$link
methodpublicload( \$link $link,  $params = array() ) : void
inherited

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

Link2 loads the relationship for this link.

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

Inherited from: \M2MRelationship::relationship_exists()
Parameters
Name Type Description
$lhs
$rhs
Returns
Type Description
bool
methodpublicremove( \$lhs $lhs, \$rhs $rhs ) : boolean
inherited

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

SugarBean

$rhs \$rhs

SugarBean

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
inherited

Removes one or more rows from the relationship table

Inherited from: \SugarRelationship::removeRow()\M2MRelationship::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
inherited

Removes the reversed version of this relationship

Inherited from: \M2MRelationship::removeSelfReferencing()
Parameters
Name Type Description
$lhs
$rhs
$additionalFields array
methodpublicresaveRelatedBeans( ) : void
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.