data/Relationships/One2OneRelationship.php
\One2OneRelationship
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
$beansToResave= 'array()'
array()
Details- Type
- n/a
- Inherited_from
- \SugarRelationship::$$beansToResave
- Inherited_from
- \M2MRelationship::$$beansToResave
$def= ''
- Type
- n/a
- Inherited_from
- \SugarRelationship::$$def
- Inherited_from
- \M2MRelationship::$$def
$ignore_role_filter= 'false'
false
Details- Type
- n/a
- Inherited_from
- \SugarRelationship::$$ignore_role_filter
- Inherited_from
- \M2MRelationship::$$ignore_role_filter
$lhsLink= ''
- Type
- n/a
- Inherited_from
- \SugarRelationship::$$lhsLink
- Inherited_from
- \M2MRelationship::$$lhsLink
$rhsLink= ''
- Type
- n/a
- Inherited_from
- \SugarRelationship::$$rhsLink
- Inherited_from
- \M2MRelationship::$$rhsLink
$self_referencing= 'false'
false
Details- Type
- n/a
- Inherited_from
- \SugarRelationship::$$self_referencing
- Inherited_from
- \M2MRelationship::$$self_referencing
$type= '"many-to-many"'
"many-to-many"
Details- Type
- n/a
- Inherited_from
- \M2MRelationship::$$type
Methods
add(
\$lhs $lhs, \$rhs $rhs, \$additionalFields $additionalFields
=
array()
)
:
boolean
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 |
Type | Description |
---|---|
boolean | true if successful |
addRow(
array $row
)
:
bool | void
Name | Type | Description |
---|---|---|
$row | array | values to be inserted into the relationship |
Type | Description |
---|---|
bool | void | null if new row was inserted and true if an existing row was updated |
addSelfReferencing(
$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
Inherited from: \M2MRelationship::addSelfReferencing()Name | Type | Description |
---|---|---|
$lhs | ||
$rhs | ||
$additionalFields | array |
addToResaveList(
\SugarBean $bean
)
:
void
Adds a realted Bean to the list to be resaved along with the current bean.
Inherited from: \SugarRelationship::addToResaveList()\M2MRelationship::addToResaveList()Name | Type | Description |
---|---|---|
$bean | \SugarBean |
- Static
callAfterAdd(
\SugarBean $focus, \SugarBean $related, string $link_name
=
""
)
:
void
Call the after add logic hook for a given link
Inherited from: \SugarRelationship::callAfterAdd()\M2MRelationship::callAfterAdd()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 |
callAfterDelete(
\SugarBean $focus, \SugarBean $related, string $link_name
=
""
)
:
void
Name | Type | Description |
---|---|---|
$focus | \SugarBean | |
$related | \SugarBean | |
$link_name | string |
callBeforeAdd(
\SugarBean $focus, \SugarBean $related, string $link_name
=
""
)
:
void
Call the before add logic hook for a given link
Inherited from: \SugarRelationship::callBeforeAdd()\M2MRelationship::callBeforeAdd()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 |
callBeforeDelete(
\SugarBean $focus, \SugarBean $related, string $link_name
=
""
)
:
void
Name | Type | Description |
---|---|---|
$focus | \SugarBean | |
$related | \SugarBean | |
$link_name | string |
checkExisting(
$row
)
:
array | bool
Checks for an existing row who's keys match the one passed in.
Inherited from: \SugarRelationship::checkExisting()\M2MRelationship::checkExisting()Name | Type | Description |
---|---|---|
$row |
Type | Description |
---|---|
array | bool | returns false if now row is found, otherwise the row is returned |
getAlternateKeyFields(
)
:
Array
Type | Description |
---|---|
Array | - set of fields that uniquely identify an entry in this relationship |
getCustomLogicArguments(
\SugarBean $focus, \SugarBean $related, string $link_name
)
:
array
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 |
Type | Description |
---|---|
array | base arguments to pass to relationship logic hooks |
getFields(
)
:
array
Type | Description |
---|---|
array | names of fields stored on the relationship |
getJoin(
\Link2 $link, $params
=
array(), $return_array
=
false
)
:
string | array
Name | Type | Description |
---|---|---|
$link | \Link2 | |
$params | ||
$return_array |
Type | Description |
---|---|
string | array | the query to join against the related modules table for the given link. |
getLinkedDefForModuleByRelationship(
$module
)
:
array | bool
Find the link entry for a particular relationship and module.
Inherited from: \M2MRelationship::getLinkedDefForModuleByRelationship()Name | Type | Description |
---|---|---|
$module |
Type | Description |
---|---|
array | bool |
getMostAppropriateLinkedDefinition(
$links
)
:
bool
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()Name | Type | Description |
---|---|---|
$links |
Type | Description |
---|---|
bool |
getOptionalWhereClause(
\$optional_array $optional_array
)
:
string
Name | Type | Description |
---|---|---|
$optional_array | \$optional_array | clause to add to the where query when populating this relationship. It should be in the |
Type | Description |
---|---|
string |
getQuery(
\$link $link, $params
=
array()
)
:
string | array
This is currently public, but should prob be made protected later. See Link2->getQuery
Name | Type | Description |
---|---|---|
$link | \$link | Link Object to get query for. |
$params |
Type | Description |
---|---|
string | array | query used to load this relationship |
getRelationshipTable(
)
:
string
Type | Description |
---|---|
string | name of the table for this relationship |
getRoleWhere(
string $table
=
"", $ignore_role_filter
=
false
)
:
string
Gets the relationship role column check for the where clause
Inherited from: \SugarRelationship::getRoleWhere()\M2MRelationship::getRoleWhere()Name | Type | Description |
---|---|---|
$table | string | |
$ignore_role_filter |
Type | Description |
---|---|
string |
getRowToInsert(
$lhs, $rhs, $additionalFields
=
array()
)
:
void
Name | Type | Description |
---|---|---|
$lhs | ||
$rhs | ||
$additionalFields |
getSubpanelQuery(
$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
Inherited from: \M2MRelationship::getSubpanelQuery()Name | Type | Description |
---|---|---|
$link | ||
$params | array | |
$return_array | bool |
Type | Description |
---|---|
String | Array |
isParentRelationship(
)
:
bool
Type | Description |
---|---|
bool | true if the relationship is a flex / parent relationship |
linkIsLHS(
$link
)
:
void
Name | Type | Description |
---|---|---|
$link |
load(
\$link $link, $params
=
array()
)
:
void
Name | Type | Description |
---|---|---|
$link | \$link | Link2 loads the relationship for this link. |
$params |
relationship_exists(
$lhs, $rhs
)
:
bool
Name | Type | Description |
---|---|---|
$lhs | ||
$rhs |
Type | Description |
---|---|
bool |
remove(
\$lhs $lhs, \$rhs $rhs
)
:
boolean
Name | Type | Description |
---|---|---|
$lhs | \$lhs | SugarBean |
$rhs | \$rhs | SugarBean |
Type | Description |
---|---|
boolean |
removeAll(
\$link $link
)
:
boolean
Name | Type | Description |
---|---|---|
$link | \$link | Link2 removes all the beans associated with this link from the relationship |
Type | Description |
---|---|
boolean | true if it was successful, false if it was not |
removeById(
\$rowID $rowID
)
:
void
Name | Type | Description |
---|---|---|
$rowID | \$rowID | id of SugarBean to remove from the relationship |
removeRow(
\$where $where
)
:
bool | resource
Removes one or more rows from the relationship table
Inherited from: \SugarRelationship::removeRow()\M2MRelationship::removeRow()Name | Type | Description |
---|---|---|
$where | \$where | array of field=>value pairs to match |
Type | Description |
---|---|
bool | resource |
removeSelfReferencing(
$lhs, $rhs, array $additionalFields
=
array()
)
:
void
Removes the reversed version of this relationship
Inherited from: \M2MRelationship::removeSelfReferencing()Name | Type | Description |
---|---|---|
$lhs | ||
$rhs | ||
$additionalFields | array |
resaveRelatedBeans(
)
:
void
- Static