data/Relationships/SugarRelationship.php
Constants
Package: SugarCRMA 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
Methods
addRow(
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 |
addToResaveList(
\SugarBean $bean
)
:
void
staticAdds a realted Bean to the list to be resaved along with the current bean.
Parameters
Details
- Static
-
callAfterAdd(
\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 |
callBeforeAdd(
\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 |
checkExisting(
$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 |
getCustomLogicArguments(
\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 |
getOptionalWhereClause(
\$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
getQuery(
\$link $link, $params
=
array()
)
:
string | array
abstractGets 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
-
getRoleWhere(
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
load(
\$link $link, $params
=
array()
)
:
void
Parameters
Name |
Type |
Description |
$link |
\$link |
Link2 loads the rows for this relationship that match the given link |
$params |
|
|
Details
- Abstract
-
remove(
\$lhs $lhs, \$rhs $rhs
)
:
boolean
Parameters
Name |
Type |
Description |
$lhs |
\$lhs |
SugarBean |
$rhs |
\$rhs |
SugarBean |
Returns
Details
- Abstract
-
removeAll(
\$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 |
removeById(
\$rowID $rowID
)
:
void
Parameters
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
Parameters
Name |
Type |
Description |
$where |
\$where |
array of field=>value pairs to match
|
Returns
Type |
Description |
bool | resource |
|
updateRow(
\$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 |