data/Relationships/One2OneBeanRelationship.php
\One2OneBeanRelationship
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
$beansToResave= 'array()'
array()
Details- Type
- n/a
- Inherited_from
- \SugarRelationship::$$beansToResave
- Inherited_from
- \M2MRelationship::$$beansToResave
- Inherited_from
- \One2MRelationship::$$beansToResave
- Inherited_from
- \One2MBeanRelationship::$$beansToResave
$def= ''
- Type
- n/a
- Inherited_from
- \SugarRelationship::$$def
- Inherited_from
- \M2MRelationship::$$def
- Inherited_from
- \One2MRelationship::$$def
- Inherited_from
- \One2MBeanRelationship::$$def
$ignore_role_filter= 'false'
false
Details- Type
- n/a
- Inherited_from
- \SugarRelationship::$$ignore_role_filter
- Inherited_from
- \M2MRelationship::$$ignore_role_filter
- Inherited_from
- \One2MRelationship::$$ignore_role_filter
- Inherited_from
- \One2MBeanRelationship::$$ignore_role_filter
$lhsLink= ''
- Type
- n/a
- Inherited_from
- \SugarRelationship::$$lhsLink
- Inherited_from
- \M2MRelationship::$$lhsLink
- Inherited_from
- \One2MRelationship::$$lhsLink
- Inherited_from
- \One2MBeanRelationship::$$lhsLink
$rhsLink= ''
- Type
- n/a
- Inherited_from
- \SugarRelationship::$$rhsLink
- Inherited_from
- \M2MRelationship::$$rhsLink
- Inherited_from
- \One2MRelationship::$$rhsLink
- Inherited_from
- \One2MBeanRelationship::$$rhsLink
$self_referencing= 'false'
false
Details- Type
- n/a
- Inherited_from
- \SugarRelationship::$$self_referencing
- Inherited_from
- \M2MRelationship::$$self_referencing
- Inherited_from
- \One2MRelationship::$$self_referencing
- Inherited_from
- \One2MBeanRelationship::$$self_referencing
$type= '"one-to-many"'
"one-to-many"
Details- Type
- n/a
- Inherited_from
- \One2MBeanRelationship::$$type
Methods
__get(
$name
)
:
void
Name | Type | Description |
---|---|---|
$name |
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
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
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()\One2MRelationship::addToResaveList()\One2MBeanRelationship::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()\One2MRelationship::callAfterAdd()\One2MBeanRelationship::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()\One2MRelationship::callBeforeAdd()\One2MBeanRelationship::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()\One2MRelationship::checkExisting()\One2MBeanRelationship::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. |
getLHSLink(
)
:
String
Type | Description |
---|---|
String | left link in relationship. |
getLHSModule(
)
:
string
Type | Description |
---|---|
string | name of left hand side module. |
getLinkedDefForModuleByRelationship(
$module
)
:
array | bool
Find the link entry for a particular relationship and module.
Inherited from: \M2MRelationship::getLinkedDefForModuleByRelationship()\One2MRelationship::getLinkedDefForModuleByRelationship()\One2MBeanRelationship::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()\One2MRelationship::getMostAppropriateLinkedDefinition()\One2MBeanRelationship::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 |
getRHSLink(
)
:
String
Type | Description |
---|---|
String | right link in relationship. |
getRHSModule(
)
:
string
Type | Description |
---|---|
string | name of right hand side module. |
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()\One2MRelationship::getRoleWhere()\One2MBeanRelationship::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: \One2MBeanRelationship::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 |
load(
\$link $link, $params
=
array()
)
:
void
Name | Type | Description |
---|---|---|
$link | \$link | Link2 loads the relationship for this link. |
$params |
relationship_exists(
\SugarBean $lhs, \SugarBean $rhs
)
:
boolean
Check to see if the relationship already exist.
Inherited from: \One2MBeanRelationship::relationship_exists()If it does return true otherwise return false
Name | Type | Description |
---|---|---|
$lhs | \SugarBean | Left hand side of the relationship |
$rhs | \SugarBean | Right hand side of the relationship |
Type | Description |
---|---|
boolean |
remove(
\$lhs $lhs, \$rhs $rhs, $save
=
true
)
:
boolean
Name | Type | Description |
---|---|---|
$lhs | \$lhs | SugarBean |
$rhs | \$rhs | SugarBean |
$save |
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()\One2MRelationship::removeRow()\One2MBeanRelationship::removeRow()Name | Type | Description |
---|---|---|
$where | \$where | array of field=>value pairs to match |
Type | Description |
---|---|
bool | resource |
removeSelfReferencing(
$lhs, $rhs, array $additionalFields
=
array()
)
:
void
Just overriding the function from M2M to prevent it from occuring
Inherited from: \One2MRelationship::removeSelfReferencing()\One2MBeanRelationship::removeSelfReferencing()Name | Type | Description |
---|---|---|
$lhs | ||
$rhs | ||
$additionalFields | array |
resaveRelatedBeans(
)
:
void
- Static
updateFields(
$lhs, $rhs, $additionalFields
)
:
void
Name | Type | Description |
---|---|---|
$lhs | ||
$rhs | ||
$additionalFields |
updateLinks(
$lhs, $lhsLinkName, $rhs, $rhsLinkName
)
:
void
Name | Type | Description |
---|---|---|
$lhs | ||
$lhsLinkName | ||
$rhs | ||
$rhsLinkName |
updateRow(
\$id $id, \$values $values
)
:
resource
Name | Type | Description |
---|---|---|
$id | \$id | id of row to update |
$values | \$values | values to insert into row |
Type | Description |
---|---|
resource | result of update satatement |