Update
class Update extends DAOUpdateAction
Update one or more records with new values. Use the where clause to select them.
Traits
Properties
protected int | $version | Api version number; cannot be changed. | from AbstractAction |
protected array | $chain | Additional api requests - will be called once per result. | from AbstractAction |
protected bool | $checkPermissions | Whether to enforce acl permissions based on the current user. | from AbstractAction |
protected string | $_entityName | from AbstractAction | |
protected string | $_actionName | from AbstractAction | |
protected array | $where | Criteria for selecting items to update. | from DAOUpdateAction |
protected array | $orderBy | Array of field(s) to use in ordering the results | from AbstractQueryAction |
protected int | $limit | Maximum number of results to return. | from AbstractQueryAction |
protected int | $offset | Zero-based index of first result to return. | from AbstractQueryAction |
protected array | $values | Field values to update. | from AbstractUpdateAction |
protected bool | $reload | Reload objects after saving. | from AbstractUpdateAction |
protected string | $language | Specify the language to use if this is a multi-lingual environment. | from DAOActionTrait |
Methods
Magic function to provide addFoo, getFoo and setFoo for params.
Get documentation for one or all params
Validates required fields for actions which create a new object.
This function is used internally for evaluating field annotations.
No description
Adds one or more AND/OR/NOT clause groups
A human-readable where clause, for the reading enjoyment of you humans.
Write bao objects as part of a create/update action.
Check edit/delete permissions for contacts and related entities.
Details
in CustomValueActionTrait at line 50
__construct($customGroup, $actionName)
in AbstractAction at line 149
__set($name, $value)
Strictly enforce api parameters
in AbstractAction at line 158
$this
setVersion(int $val)
in AbstractAction at line 174
$this
addChain(string $name, AbstractAction $apiRequest, string|int $index = NULL)
in AbstractAction at line 187
AbstractAction|mixed
__call($name, $arguments)
Magic function to provide addFoo, getFoo and setFoo for params.
in AbstractAction at line 231
Result
execute()
Invoke api call.
At this point all the params have been sent in and we initiate the api call & return the result. This is basically the outer wrapper for api v4.
in DAOUpdateAction at line 60
_run(Result $result)
in AbstractAction at line 247
array
getParams()
Serialize this object's params into an array
in AbstractAction at line 265
array
getParamInfo(string $param = NULL)
Get documentation for one or all params
in CustomValueActionTrait at line 65
getEntityName()
in AbstractAction at line 290
string
getActionName()
in AbstractAction at line 298
bool
paramExists(string $param)
in AbstractAction at line 305
protected array
getParamDefaults()
in AbstractAction at line 312
offsetExists($offset)
in AbstractAction at line 319
offsetGet($offset)
in AbstractAction at line 344
offsetSet($offset, $value)
in AbstractAction at line 359
offsetUnset($offset)
in AbstractAction at line 373
bool
isAuthorized()
Is this api call permitted?
This function is called if checkPermissions is set to true.
in AbstractAction at line 381
array
getPermissions()
in AbstractAction at line 410
array
entityFields()
Returns schema fields for this entity & action.
Here we bypass the api wrapper and execute the getFields action directly. This is because we DON'T want the wrapper to check permissions as this is an internal op, but we DO want permissions to be checked inside the getFields request so e.g. the api_key field can be conditionally included.
in AbstractAction at line 429
ReflectionClass
reflect()
in AbstractAction at line 443
protected array
checkRequiredFields($values)
Validates required fields for actions which create a new object.
in AbstractAction at line 473
protected bool
evaluateCondition(string $expr, array $vars)
This function is used internally for evaluating field annotations.
It should never be passed raw user input.
in AbstractAction at line 50
bool
getCheckPermissions()
in AbstractAction at line 50
array
getChain()
in AbstractQueryAction at line 104
$this
addWhere(string $field, string $op, mixed $value = NULL)
in AbstractQueryAction at line 122
$this
addClause(string $operator, mixed $condition1)
Adds one or more AND/OR/NOT clause groups
in AbstractQueryAction at line 135
$this
addOrderBy(string $field, string $direction = 'ASC')
in AbstractQueryAction at line 147
protected string
whereClauseToString(array $whereClause = NULL, string $op = 'AND')
A human-readable where clause, for the reading enjoyment of you humans.
in AbstractQueryAction at line 54
array
getWhere()
in AbstractQueryAction at line 54
array
getOrderBy()
in AbstractQueryAction at line 54
int
getLimit()
in AbstractQueryAction at line 54
int
getOffset()
in AbstractBatchAction at line 77
protected array
getBatchRecords()
in AbstractBatchAction at line 95
protected array
getSelect()
in AbstractUpdateAction at line 76
mixed|null
getValue(string $key)
in AbstractUpdateAction at line 51
array
getValues()
Get field values.
in AbstractUpdateAction at line 51
bool
getReload()
in DAOActionTrait at line 61
protected CRM_Core_DAO|string
getBaoName()
in DAOActionTrait at line 73
static array
baoToArray(object $bao)
Extract the true fields from a BAO
(Used by create and update actions)
in DAOActionTrait at line 88
protected array|int
getObjects()
in DAOActionTrait at line 109
protected
fillDefaults(array $params)
Fill field defaults which were declared by the api.
Note: default values from core are ignored because the BAO or database layer will supply them.
in DAOActionTrait at line 131
protected array
writeObjects(array $items)
Write bao objects as part of a create/update action.
in DAOActionTrait at line 214
protected mixed
formatCustomParams(array $params, int $entityId)
in DAOActionTrait at line 280
protected
checkContactPermissions($baoName, $item)
Check edit/delete permissions for contacts and related entities.