Documentation

CRM_Core_BAO_CustomValueTable
in package

Tags
copyright

CiviCRM LLC https://civicrm.org/licensing

Table of Contents

Methods

create()  : mixed
fieldToSQLType()  : string
Given a field return the mysql data type associated with it.
getEntityValues()  : array<string|int, mixed>
Return an array of all custom values associated with an entity.
getValues()  : array<string|int, mixed>
Take in an array of entityID, custom_ID and gets the value from the appropriate table.
postProcess()  : mixed
Post process function.
setValues()  : array<string|int, mixed>
Take in an array of entityID, custom_XXX => value and set the value in the appropriate table. Should also be able to set the value to null. Follows api parameter/return conventions
store()  : mixed

Methods

create()

public static create(array<string|int, mixed> $customParams[, string $parentOperation = NULL ]) : mixed
Parameters
$customParams : array<string|int, mixed>
$parentOperation : string = NULL

Operation being taken on the parent entity. If we know the parent entity is doing an insert we can skip the ON DUPLICATE UPDATE - which improves performance and reduces deadlocks.

  • edit
  • create
Tags
throws
Exception

fieldToSQLType()

Given a field return the mysql data type associated with it.

public static fieldToSQLType(string $type[, int $maxLength = 255 ]) : string
Parameters
$type : string
$maxLength : int = 255
Return values
string

the mysql data store placeholder

getEntityValues()

Return an array of all custom values associated with an entity.

public static getEntityValues(int $entityID[, string $entityType = NULL ][, array<string|int, mixed> $fieldIDs = NULL ][, bool $formatMultiRecordField = FALSE ][, array<string|int, mixed> $DTparams = NULL ]) : array<string|int, mixed>
Parameters
$entityID : int

Identification number of the entity.

$entityType : string = NULL

Type of entity that the entityID corresponds to, specified. as a string with format "'<EntityName>'". Comma separated list may be used to specify OR matches. Allowable values are enumerated types in civicrm_custom_group.extends field. Optional. Default value assumes entityID references a contact entity.

$fieldIDs : array<string|int, mixed> = NULL

Optional list of fieldIDs that we want to retrieve. If this. is set the entityType is ignored

$formatMultiRecordField : bool = FALSE
$DTparams : array<string|int, mixed> = NULL
  • CRM-17810 dataTable params for the multiValued custom fields.
Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>

Array of custom values for the entity with key=>value pairs specified as civicrm_custom_field.id => custom value. Empty array if no custom values found.

getValues()

Take in an array of entityID, custom_ID and gets the value from the appropriate table.

public static getValues(array<string|int, mixed> $params) : array<string|int, mixed>

To get the values of custom fields with IDs 13 and 43 for contact ID 1327, use: $params = array( 'entityID' => 1327, 'custom_13' => 1, 'custom_43' => 1 );

Entity Type will be inferred by the custom fields you request Specify $params['entityType'] if you do not supply any custom fields to return and entity type is other than Contact

Parameters
$params : array<string|int, mixed>
Tags
array

$params

throws
Exception
Return values
array<string|int, mixed>

postProcess()

Post process function.

public static postProcess(array<string|int, mixed> &$params, mixed $entityTable, int $entityID, mixed $customFieldExtends[, mixed $parentOperation = NULL ]) : mixed
Parameters
$params : array<string|int, mixed>
$entityTable : mixed
$entityID : int
$customFieldExtends : mixed
$parentOperation : mixed = NULL

setValues()

Take in an array of entityID, custom_XXX => value and set the value in the appropriate table. Should also be able to set the value to null. Follows api parameter/return conventions

public static setValues(array<string|int, mixed> &$params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>
Tags
array

$params

throws
Exception
Return values
array<string|int, mixed>

store()

public static store(array<string|int, mixed> $params, mixed $entityTable, int $entityID[, string $parentOperation = NULL ]) : mixed
Parameters
$params : array<string|int, mixed>
$entityTable : mixed
$entityID : int
$parentOperation : string = NULL

Operation being taken on the parent entity. If we know the parent entity is doing an insert we can skip the ON DUPLICATE UPDATE - which improves performance and reduces deadlocks.

  • edit
  • create

        
On this page

Search results