Documentation

CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup
in package
implements HookInterface

UF group BAO class.

Table of Contents

Interfaces

HookInterface
Interface HookInterface

Constants

ADMIN_VISIBILITY  = 2
BULK_INSERT_COUNT  = 200
BULK_INSERT_HIGH_COUNT  = 200
DB_DAO_NOTNULL  = 128
IS_NULL  = 2
LISTINGS_VISIBILITY  = 4
NOT_NULL  = 1
PUBLIC_VISIBILITY  = 1
QUERY_FORMAT_NO_QUOTES  = 2
QUERY_FORMAT_WILDCARD  = 1
SERIALIZE_COMMA  = 5
Comma separated string, no quotes, no spaces
SERIALIZE_JSON  = 3
Recommended serialization format
SERIALIZE_NONE  = 0
No serialization.
SERIALIZE_PHP  = 4
SERIALIZE_SEPARATOR_BOOKEND  = 1
Serialized string separated by and bookended with VALUE_SEPARATOR
SERIALIZE_SEPARATOR_TRIMMED  = 2
VALUE_SEPARATOR  = "\x01"

Properties

$_dbColumnValueCache  : mixed
$_icon  : string
Icon associated with this entity.
$_labelField  : string
Field to show when displaying a record.
$_matchFields  : string
Cache the match clause used in this transaction.
$_nullArray  : array<string|int, mixed>
$_nullObject  : null
$_primaryKey  : array<string|int, string>
Primary key field(s).
$_testEntitiesToSkip  : array<string|int, mixed>
Define entities that shouldn't be created or deleted when creating/ deleting test objects - this prevents world regions, countries etc from being added / deleted
$add_cancel_button  : bool|string
$add_captcha  : bool|string
$add_to_group_id  : int|string|null
$cancel_button_text  : string|null
$cancel_url  : string|null
$created_date  : string|null
$created_id  : int|string|null
$description  : string|null
$frontend_title  : string
$group_type  : string|null
$help_post  : string|null
$help_pre  : string|null
$id  : int|string|null
$is_active  : bool|string
$is_cms_user  : bool|string
$is_edit_link  : bool|string
$is_map  : bool|string
$is_proximity_search  : bool|string
$is_reserved  : bool|string
$is_uf_link  : bool|string
$is_update_dupe  : bool|string
$limit_listings_group_id  : int|string|null
$name  : string
$notify  : string|null
$post_url  : string|null
$submit_button_text  : string|null
$title  : string
$_options  : array<string|int, mixed>
https://issues.civicrm.org/jira/browse/CRM-17748 internal variable for DAO to hold per-query settings
$resultCopies  : int
How many times has this instance been cloned.

Methods

__clone()  : mixed
__construct()  : static
Class constructor.
__destruct()  : mixed
Class destructor.
_calculateGroupType()  : array<string|int, mixed>
Calculate the profile type 'group_type' as per profile fields.
acceptedSQLOperators()  : array<string|int, string>
add()  : object
Add the UF Group.
addSelectWhereClause()  : array<string|int, mixed>
Generates acl clauses suitable for adding to WHERE or ON when doing an api.get for this entity
addUFJoin()  : CRM_Core_DAO_UFJoin
Function takes an associative array and creates a ufjoin record for ufgroup.
appendPseudoConstantsToFields()  : mixed
Update the fields array to also hold keys for pseudoconstant fields that relate to contained fields.
buildOptions()  : array<string|int, mixed>|bool
Legacy field options getter.
buildOptionsContext()  : array<string|int, mixed>
Provides documentation and validation for the buildOptions $context param
buildProfile()  : null
Add profile field to a form.
calculateGroupType()  : array<string|int, mixed>
Calculate the profile type 'group_type' as per profile fields.
cascadeUpdate()  : CRM_Core_DAO|null
Cascade update through related entities.
checkConstraintExists()  : bool
Checks if a constraint exists for a specified table.
checkFieldHasAlwaysValue()  : mixed
Check whether a specific column in a specific table has always the same value.
checkFieldIsAlwaysNull()  : mixed
Check whether a specific column in a specific table is always NULL.
checkFieldsEmptyValues()  : array<string|int, mixed>
Given a contact id and a group id, returns the field values from the db for this group and notify email only if group's notify field is set and field values are not empty
checkFKConstraintInFormat()  : mixed
Checks if the FK constraint name is in the format 'FK_tableName_columnName' for a specified column of a table.
checkForMixProfiles()  : bool
Check if we are rendering mixed profiles.
checkTableExists()  : bool
Check if there is a given table in the database.
checkTableHasData()  : bool
Check if a given table has data.
checkTriggerViewPermission()  : bool
checkValidProfile()  : array<string|int, mixed>
Check whether a profile is valid combination of required profile fields
commonRetrieveAll()  : object
Fetch object based on array of properties.
commonSendMail()  : mixed
Process that send notification e-mails
composeQuery()  : string
Compose the query by merging the parameters into it.
copy()  : CRM_Core_DAO
make a copy of a profile, including all the fields in the profile
copyCustomFields()  : mixed
Method that copies custom fields values from an old entity to a new one.
copyGeneric()  : CRM_Core_DAO|bool
Make a shallow copy of an object and all the fields in the object.
copyValues()  : bool
Given an associative array of name/value pairs, extract all the values that belong to this object and initialize the object with said values
createReferenceColumns()  : array<string|int, CRM_Core_Reference_Interface>
Given a list of fields, create a list of references.
createSQLFilter()  : null|string|array<string|int, mixed>
Get SQL where clause for SQL filter syntax input parameters.
createTestObject()  : object|array<string|int, mixed>|null
Creates a test object, including any required objects it needs via recursion createOnly: only create in database, do not store or return the objects (useful for perf testing) ONLY USE FOR TESTING
createTriggers()  : mixed
createUFJoin()  : mixed
Make uf join entries for an uf group.
debugPrint()  : mixed
del()  : bool
Delete the profile Group.
delete()  : int|false
Deletes items from table which match current objects variables.
deleteEntityContact()  : mixed
Unused function.
deleteRecord()  : static
Delete a record from supplied params.
deleteRecords()  : array<string|int, static>
Bulk delete multiple records.
deleteTestObjects()  : mixed
Deletes the this object plus any dependent objects that are associated with it.
delUFJoin()  : mixed
Delete the uf join record for an uf group.
disableFullGroupByMode()  : mixed
Disables usage of the ONLY_FULL_GROUP_BY Mode if necessary
dropAllTables()  : mixed
Drop all CiviCRM tables.
dropTriggers()  : mixed
Wrapper function to drop triggers.
encodeGroupType()  : string
Create a "group_type" string.
escapeString()  : string
escapeStrings()  : string
Escape a list of strings for use with "WHERE X IN (...)" queries.
escapeWildCardString()  : string
executeQuery()  : CRM_Core_DAO|object
Execute a query.
executeUnbufferedQuery()  : CRM_Core_DAO
Execute an unbuffered query.
export()  : array<string|int, mixed>
Returns the list of fields that can be exported
fetchAll()  : array<string|int, mixed>
Returns all results as array-encoded records.
fetchGenerator()  : mixed
Return the results as PHP generator.
fetchMap()  : array<string|int, mixed>
Get all the result records as mapping between columns.
fetchValue()  : mixed|null
Returns a singular value.
fieldKeys()  : array<string|int, mixed>
Return a mapping from field-name to the corresponding key (as used in fields()).
fields()  : array<string|int, mixed>
Returns all the column names of this table.
fillValues()  : array<string|int, mixed>
Given an incomplete record, attempt to fill missing field values from the database
filterUFGroups()  : bool
Filter ufgroups based on logged in user contact type.
findById()  : static
Find a DAO object for the given ID and return it.
findReferences()  : array<string|int, CRM_Core_DAO>
Find all records which refer to this entity.
formatFields()  : array<string|int, mixed>
Format fields for dupe Contact Matching.
formatFieldValues()  : void
Format field values according to fields() metadata.
formatUFFields()  : array<string|int, mixed>
Format a list of UFFields for use with buildProfile. This is the in-memory analog of getFields().
freeResult()  : mixed
getAttribute()  : array<string|int, mixed>
Get the size and maxLength attributes for this text field.
getBatchProfiles()  : array<string|int, mixed>
Get profiles used for batch entry.
getConnection()  : DB_common
getContactIDsFromComponent()  : array<string|int, mixed>
Given the component id, compute the contact id since its used for things like send email
getContactType()  : string
Retrieve the first non-generic contact type
getDatabaseName()  : string
Get the name of the CiviCRM database.
getDbVal()  : array<string|int, mixed>|bool|int|string|null
Fetch a single field value from the database.
getDefaultFallbackValues()  : mixed
Callback for `default_fallback` field values
getDoubleOptInGroupIds()  : array<string|int, mixed>
Alter contact params by filtering existing subscribed groups and returns unsubscribed groups array for subscription.
getDynamicReferencesToTable()  : array<string|int, mixed>
Get all dynamic references to the given table.
getEditHTML()  : string
Get the html for the form that represents this particular group.
getEntityDescription()  : string|null
Returns user-friendly description of this entity.
getEntityIcon()  : string|null
Overridable function to get icon for a particular entity.
getEntityPaths()  : array<string|int, mixed>
Returns system paths related to this entity (as defined in the xml schema)
getEntityRefFilters()  : array<string|int, mixed>
getEntityTitle()  : string
Returns localized title of this entity.
getExportableFieldsWithPseudoConstants()  : array<string|int, mixed>
Get exportable fields with pseudoconstants rendered as an extra field.
getExtensionName()  : string|null
Get name of extension in which this DAO is defined.
getFields()  : array<string|int, mixed>
Get all the fields that belong to the group with the name title, and format for use with buildProfile. This is the SQL analog of formatUFFields().
getFieldSpec()  : bool|array<string|int, mixed>
getFieldValue()  : string|int|null
Given a DAO name, a column name and a column value, find the record and GET the value of another column in that record
getFrontEndTitle()  : string
Get the frontend_title for the profile, falling back on 'title' if none.
getGlobalSetting()  : mixed
Lookup the value of a MySQL global configuration variable.
getLabelField()  : string|null
getListingFields()  : array<string|int, mixed>
Get all the listing fields.
getLocaleTableName()  : string
Get localized name of this table, if applicable.
getLocationFields()  : array<string|int, mixed>
Get the fields relating to locations.
getLog()  : bool
Returns if this table needs to be logged
getModuleUFGroup()  : array<string|int, mixed>
Get the uf group for a module.
getOptionLabels()  : mixed
Populate option labels for this object's fields.
getProfiles()  : array<string|int, mixed>
Get profiles by type eg: pure Individual etc
getReferenceColumns()  : array<string|int, CRM_Core_Reference_Basic>
Returns list of FK relationships.
getReferenceCounts()  : array<string|int, array{name: string, type: string, count: int, table: string|null, key: string|null}>
getReferencesToContactTable()  : mixed
Get all references to contact table.
getReferencesToTable()  : array<string|int, CRM_Core_Reference_Interface>
List all tables which have either: - hard foreign keys to this table, or - a dynamic foreign key that includes this table as a possible target.
getRegistrationFields()  : array<string|int, mixed>
Get all the registration fields.
getSelectWhereClause()  : array<string|int, mixed>
This returns the final permissioned query string for this entity
getSortString()  : mixed
Unused function.
getSupportedFields()  : array<string|int, mixed>
Returns all usable fields, indexed by name.
getTableName()  : string
Returns the name of this table
getTableNames()  : array<string|int, mixed>
Gets the names of all enabled schema tables.
getTitle()  : string
Get the form title.
getUFJoinRecord()  : array<string|int, mixed>
Get the UF Join records for an ufgroup id.
getValidProfiles()  : array<string|int, mixed>
Check whether a profile is valid combination of required and/or optional profile types
getValues()  : null|array<string|int, mixed>
Given a contact id and a field set, return the values from the db.
getWeight()  : int
Get the weight for ufjoin record.
groupTypeValues()  : array<string|int, mixed>
Get group type values of the profile.
import()  : array<string|int, mixed>
Returns the list of fields that can be imported
indices()  : array<string|int, mixed>
init()  : mixed
Initialize the DAO object.
initialize()  : mixed
Initialization for all DAO objects. Since we access DB_DO programatically we need to set the links manually.
isComponentEnabled()  : bool
Check if component is enabled for this DAO class
isDBMyISAM()  : bool
isProfileAddToGroupDoubleOptin()  : bool|object
isProfileDoubleOptin()  : bool|object
isValid()  : bool
Check the data validity.
isValidOption()  : bool
Wrapper to validate internal DAO options before passing to DB_mysql/DB_Common level
keys()  : array<string|int, string>
Returns primary keys (usually ['id'])
log()  : mixed
makeAttribute()  : array<string|int, mixed>|null
Create an attribute for this specific field. We only do this for strings and text
objectExists()  : bool
Check if there is a record with the same name in the db.
profileGroups()  : array<string|int, mixed>
Retrieve groups of profiles.
query()  : object
Execute a query by the current DAO, localizing it along the way (if needed).
reenableFullGroupByMode()  : mixed
Re-enables ONLY_FULL_GROUP_BY sql_mode as necessary.
reformatProfileFields()  : mixed
This is function is used to format pseudo fields.
requireSafeDBName()  : bool
ensure database name is 'safe', i.e. only contains word characters (includes underscores) and dashes, and contains at least one [a-z] case insensitive.
reset()  : mixed
Reset the DAO object.
retrieve()  : object
Fetch object based on array of properties.
save()  : CRM_Core_DAO
Save DAO object.
schemaRequiresRebuilding()  : mixed
Checks if CONSTRAINT keyword exists for a specified table.
self_hook_civicrm_post()  : mixed
Callback for hook_civicrm_post().
self_hook_civicrm_pre()  : mixed
Callback for hook_civicrm_pre().
sequenceKey()  : array<string|int, mixed>
Tells DB_DataObject which keys use autoincrement.
serializeField()  : string|null
Transform an array to a serialized string for database storage.
setApiFilter()  : mixed
setComponentDefaults()  : mixed
setDefault component specific profile fields.
setCreateDefaults()  : mixed
Set defaults when creating new entity.
setFieldValue()  : bool
Given a DAO name, a column name and a column value, find the record and SET the value of another column in that record
setIsActive()  : bool
setOptions()  : mixed
https://issues.civicrm.org/jira/browse/CRM-17748 Sets the internal options to be used on a query
setProfileDefaults()  : mixed
Set profile defaults.
setRegisterDefaults()  : array<string|int, mixed>
Get default value for Register.
shiftMultiRecordFields()  : array<string|int, mixed>|null
shortenSQLName()  : string
SQL has a limit of 64 characters on various names: table name, trigger name, column name ... For custom groups and fields we generated names from user entered input which can be longer than this length, this function helps with creating strings that meet various criteria.
showOverlayProfile()  : bool
Determine of we show overlay profile or not.
singleValueQuery()  : string|null
Execute a query and get the single result.
storeValues()  : mixed
Store all the values from this object in an associative array this is a destructive store, calling function is responsible for keeping sanity of id's.
table()  : array<string|int, mixed>
Get/set an associative array of table columns
tableHasBeenAdded()  : bool
Checks if this DAO's table ought to exist.
triggerRebuild()  : mixed
Build a list of triggers via hook and add them to (err, reconcile them with) the database.
unSerializeField()  : array<string|int, mixed>|null
Transform a serialized string from the database into an array.
updateGroupTypes()  : bool
Update the profile type 'group_type' as per profile fields including group types and group subtype values.
usedByModule()  : bool
Check if profile Group used by any module.
writeRecord()  : static
Create or update a record from supplied params.
writeRecords()  : array<string|int, static>
Bulk save multiple records
_setDBOptions()  : mixed
https://issues.civicrm.org/jira/browse/CRM-17748 wrapper to pass internal DAO options down to DB_mysql/DB_Common level
assignTestFK()  : mixed
assignTestValue()  : mixed
Generate and assign an arbitrary value to a field of a test object.
copyLocalizable()  : mixed
Method that copies localizable fields from an old entity to a new one.
createUFFieldQuery()  : string
Create a query to find all visible UFFields in a UFGroup.
formatFieldValue()  : mixed
Format a value according to field metadata.
formatUFField()  : array<string|int, mixed>
Prepare a field for rendering with CRM_Core_BAO_UFGroup::buildProfile.
getCustomFields()  : array<string|int, mixed>
getDynamicFkAclClauses()  : array<string|int, mixed>
Get an array of ACL clauses for a dynamic FK (entity_id/entity_table combo)
getFirstPrimaryKey()  : string
getImportableFields()  : array<string|int, mixed>
Get a list of filtered field metadata.
getProfileFieldMetadata()  : array<string|int, mixed>
Get the metadata for all potential profile fields.
getTableAddVersion()  : string
clearDbColumnValueCache()  : mixed
Remove item from static cache during update/delete operations
formatCustomValue()  : mixed
Format custom field value for use in prepopulating a quickform profile field.
getEntityDefinition()  : array<string|int, mixed>
getEntityInfo()  : array<string|int, mixed>
getFieldLength()  : string|null
getSchemaFields()  : array<string|int, mixed>
loadSchemaFields()  : array<string|int, mixed>
makeNameFromLabel()  : void
When creating a record without a supplied name, create a unique, clean name derived from the label.
setDefaultsFromCallback()  : void
Set default values for fields based on callback functions

Constants

ADMIN_VISIBILITY

public mixed ADMIN_VISIBILITY = 2

BULK_INSERT_COUNT

public mixed BULK_INSERT_COUNT = 200

BULK_INSERT_HIGH_COUNT

public mixed BULK_INSERT_HIGH_COUNT = 200

DB_DAO_NOTNULL

public mixed DB_DAO_NOTNULL = 128

IS_NULL

public mixed IS_NULL = 2

LISTINGS_VISIBILITY

public mixed LISTINGS_VISIBILITY = 4

NOT_NULL

public mixed NOT_NULL = 1

PUBLIC_VISIBILITY

public mixed PUBLIC_VISIBILITY = 1

QUERY_FORMAT_NO_QUOTES

public mixed QUERY_FORMAT_NO_QUOTES = 2

QUERY_FORMAT_WILDCARD

public mixed QUERY_FORMAT_WILDCARD = 1

SERIALIZE_COMMA

Comma separated string, no quotes, no spaces

public mixed SERIALIZE_COMMA = 5

SERIALIZE_JSON

Recommended serialization format

public mixed SERIALIZE_JSON = 3

SERIALIZE_NONE

No serialization.

public mixed SERIALIZE_NONE = 0

SERIALIZE_PHP

format using php serialize()

public mixed SERIALIZE_PHP = 4

SERIALIZE_SEPARATOR_BOOKEND

Serialized string separated by and bookended with VALUE_SEPARATOR

public mixed SERIALIZE_SEPARATOR_BOOKEND = 1

SERIALIZE_SEPARATOR_TRIMMED

format separated by VALUE_SEPARATOR

public mixed SERIALIZE_SEPARATOR_TRIMMED = 2

VALUE_SEPARATOR

public mixed VALUE_SEPARATOR = "\x01"

Properties

$_dbColumnValueCache

public static mixed $_dbColumnValueCache = \NULL

$_icon

Icon associated with this entity.

public static string $_icon = \NULL

$_labelField

Field to show when displaying a record.

public static string $_labelField = \NULL

$_matchFields

Cache the match clause used in this transaction.

public static string $_matchFields = \NULL

$_nullArray

public static array<string|int, mixed> $_nullArray = []

$_nullObject

public static null $_nullObject = \NULL

$_primaryKey

Primary key field(s).

public static array<string|int, string> $_primaryKey = ['id']

$_testEntitiesToSkip

Define entities that shouldn't be created or deleted when creating/ deleting test objects - this prevents world regions, countries etc from being added / deleted

public static array<string|int, mixed> $_testEntitiesToSkip = []

$add_cancel_button

public bool|string $add_cancel_button

$add_captcha

public bool|string $add_captcha

$add_to_group_id

public int|string|null $add_to_group_id

$cancel_button_text

public string|null $cancel_button_text

$cancel_url

public string|null $cancel_url

$created_date

public string|null $created_date

$created_id

public int|string|null $created_id

$description

public string|null $description

$frontend_title

public string $frontend_title

$group_type

public string|null $group_type

$help_post

public string|null $help_post

$help_pre

public string|null $help_pre

$is_active

public bool|string $is_active

$is_cms_user

public bool|string $is_cms_user
public bool|string $is_edit_link
public bool|string $is_proximity_search

$is_reserved

public bool|string $is_reserved
public bool|string $is_uf_link

$is_update_dupe

public bool|string $is_update_dupe

$limit_listings_group_id

public int|string|null $limit_listings_group_id

$post_url

public string|null $post_url

$submit_button_text

public string|null $submit_button_text

$_options

https://issues.civicrm.org/jira/browse/CRM-17748 internal variable for DAO to hold per-query settings

protected array<string|int, mixed> $_options = []

$resultCopies

How many times has this instance been cloned.

protected int $resultCopies = 0

Methods

__clone()

public __clone() : mixed

__construct()

Class constructor.

public __construct() : static
Return values
static

__destruct()

Class destructor.

public __destruct() : mixed

_calculateGroupType()

Calculate the profile type 'group_type' as per profile fields.

public static _calculateGroupType(mixed $ufFields[, bool $includeTypeValues = FALSE ][, int $ignoreFieldId = NULL ]) : array<string|int, mixed>
Parameters
$ufFields : mixed
$includeTypeValues : bool = FALSE
$ignoreFieldId : int = NULL

Ignore perticular profile field.

Return values
array<string|int, mixed>

list of calculated group type

acceptedSQLOperators()

public static acceptedSQLOperators() : array<string|int, string>
Tags
see
http://issues.civicrm.org/jira/browse/CRM-9150

support for other syntaxes is discussed in ticket but being put off for now

Return values
array<string|int, string>

add()

Add the UF Group.

public static add(array<string|int, mixed> &$params[, array<string|int, mixed> $ids = [] ]) : object
Parameters
$params : array<string|int, mixed>

Reference array contains the values submitted by the form.

$ids : array<string|int, mixed> = []

Deprecated array.

Return values
object

addSelectWhereClause()

Generates acl clauses suitable for adding to WHERE or ON when doing an api.get for this entity

public addSelectWhereClause([string|null $entityName = NULL ][, int|null $userId = NULL ][, array<string|int, mixed> $conditions = [] ]) : array<string|int, mixed>

Return format is in the form of fieldname => clauses starting with an operator. e.g.:

  [
    // Each string in the array will get joined with AND
    'location_type_id' => ['IS NOT NULL', 'IN (1,2,3)'],
    // Each sub-array in the array will get joined with OR, field names must be enclosed in curly braces
    'privacy' => [
                   ['= 0', '= 1 AND {contact_id} = 456'],
                 ],
  ]

Note that all array keys must be actual field names in this entity. Use subqueries to filter on other tables e.g. custom values. The query strings MAY reference other fields in this entity; they must be enclosed in {curly_braces}.

Parameters
$entityName : string|null = NULL

Name of the entity being queried (for normal BAO files implementing this method, this variable is redundant as there is a 1-1 relationship between most entities and most BAOs. However the variable is passed in to support dynamic entities such as ECK).

$userId : int|null = NULL

Contact id of the current user. This param is more aspirational than functional for now. Someday the API may support checking permissions for contacts other than the current user, but at present this is always NULL which defaults to the current user.

$conditions : array<string|int, mixed> = []

Contains field/value pairs gleaned from the WHERE clause or ON clause (depending on how the entity was added to the query). Can be used for optimization/deduping of clauses.

Return values
array<string|int, mixed>

addUFJoin()

Function takes an associative array and creates a ufjoin record for ufgroup.

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

(reference) an assoc array of name/value pairs.

Return values
CRM_Core_DAO_UFJoin

appendPseudoConstantsToFields()

Update the fields array to also hold keys for pseudoconstant fields that relate to contained fields.

public static appendPseudoConstantsToFields(array<string|int, mixed> &$fields) : mixed

This is relevant where we want to offer both the ID field and the label field as an option, e.g. search builder.

It is currently limited for optionGroupName & id+ name+ FK combos for purposes keeping the scope of the change small, but is appropriate for other sorts of pseudoconstants.

Parameters
$fields : array<string|int, mixed>

buildOptions()

Legacy field options getter.

public static buildOptions(string $fieldName[, string $context = NULL ][, array<string|int, mixed> $values = [] ]) : array<string|int, mixed>|bool

in favor of Civi::entity()->getOptions()

Overriding this function is no longer recommended as a way to customize options. Instead, option lists can be customized by either:

  1. Using a pseudoconstant callback
  2. Implementing hook_civicrm_fieldOptions
Parameters
$fieldName : string
$context : string = NULL
$values : array<string|int, mixed> = []

Raw field values; whatever is known about this bao object.

Note: $values can contain unsanitized input and should be handled with care by CRM_Core_PseudoConstant::get

Tags
see
CRM_Core_DAO::buildOptionsContext
Return values
array<string|int, mixed>|bool

buildOptionsContext()

Provides documentation and validation for the buildOptions $context param

public static buildOptionsContext([string $context = NULL ]) : array<string|int, mixed>
Parameters
$context : string = NULL
Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>

buildProfile()

Add profile field to a form.

public static buildProfile(CRM_Core_Form &$form, array<string|int, mixed> &$field, int $mode[, int $contactId = NULL ][, bool $online = FALSE ][, string $usedFor = NULL ][, int $rowNumber = NULL ][, string $prefix = '' ]) : null
Parameters
$form : CRM_Core_Form
$field : array<string|int, mixed>

Properties.

$mode : int

Profile mode.

$contactId : int = NULL
$online : bool = FALSE
$usedFor : string = NULL

For building up prefixed fieldname for special cases (e.g. onBehalf, Honor).

$rowNumber : int = NULL
$prefix : string = ''
Return values
null

calculateGroupType()

Calculate the profile type 'group_type' as per profile fields.

public static calculateGroupType(int $gId[, bool $includeTypeValues = FALSE ][, int $ignoreFieldId = NULL ]) : array<string|int, mixed>
Parameters
$gId : int

Profile id.

$includeTypeValues : bool = FALSE
$ignoreFieldId : int = NULL

Ignore particular profile field.

Return values
array<string|int, mixed>

list of calculated group type

cascadeUpdate()

Cascade update through related entities.

public static cascadeUpdate(string $daoName, mixed $fromId, mixed $toId[, array<string|int, mixed> $newData = [] ]) : CRM_Core_DAO|null
Parameters
$daoName : string
$fromId : mixed
$toId : mixed
$newData : array<string|int, mixed> = []
Return values
CRM_Core_DAO|null

checkConstraintExists()

Checks if a constraint exists for a specified table.

public static checkConstraintExists(string $tableName, string $constraint) : bool
Parameters
$tableName : string
$constraint : string
Tags
throws
CRM_Core_Exception
Return values
bool

true if constraint exists, false otherwise

checkFieldHasAlwaysValue()

Check whether a specific column in a specific table has always the same value.

public static checkFieldHasAlwaysValue(mixed $tableName, mixed $columnName, mixed $columnValue) : mixed

in 5.72 will be removed in 5.85

Parameters
$tableName : mixed
$columnName : mixed
$columnValue : mixed

checkFieldIsAlwaysNull()

Check whether a specific column in a specific table is always NULL.

public static checkFieldIsAlwaysNull(mixed $tableName, mixed $columnName) : mixed

in 5.72 will be removed in 5.85

Parameters
$tableName : mixed
$columnName : mixed

checkFieldsEmptyValues()

Given a contact id and a group id, returns the field values from the db for this group and notify email only if group's notify field is set and field values are not empty

public static checkFieldsEmptyValues(int $gid, int $cid, array<string|int, mixed> $params[, bool $skipCheck = FALSE ]) : array<string|int, mixed>
Parameters
$gid : int

Group id.

$cid : int

Contact id.

$params : array<string|int, mixed>
$skipCheck : bool = FALSE
Return values
array<string|int, mixed>

checkFKConstraintInFormat()

Checks if the FK constraint name is in the format 'FK_tableName_columnName' for a specified column of a table.

public static checkFKConstraintInFormat(mixed $tableName, mixed $columnName) : mixed

in 5.72 will be removed in 5.85

Parameters
$tableName : mixed
$columnName : mixed

checkForMixProfiles()

Check if we are rendering mixed profiles.

public static checkForMixProfiles(array<string|int, mixed> $profileIds) : bool
Parameters
$profileIds : array<string|int, mixed>

Associated array of profile ids.

Return values
bool

true if profile is mixed

checkTableExists()

Check if there is a given table in the database.

public static checkTableExists(string $tableName) : bool
Parameters
$tableName : string
Return values
bool

true if exists, else false

checkTableHasData()

Check if a given table has data.

public static checkTableHasData(string $tableName) : bool
Parameters
$tableName : string
Return values
bool

TRUE if $tableName has at least one record.

checkTriggerViewPermission()

public static checkTriggerViewPermission([bool $view = TRUE ][, bool $trigger = TRUE ]) : bool
Parameters
$view : bool = TRUE
$trigger : bool = TRUE
Return values
bool

checkValidProfile()

Check whether a profile is valid combination of required profile fields

public static checkValidProfile(array<string|int, mixed> $ufID[, array<string|int, mixed> $required = NULL ]) : array<string|int, mixed>
Parameters
$ufID : array<string|int, mixed>

Integer id of the profile.

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

Array of fields those are required in the profile.

Return values
array<string|int, mixed>

associative array of profiles

commonRetrieveAll()

Fetch object based on array of properties.

public static commonRetrieveAll(string $daoName, string $fieldIdName, int $fieldId, mixed &$details[, array<string|int, mixed> $returnProperities = NULL ]) : object
Parameters
$daoName : string

Name of the dao object.

$fieldIdName : string
$fieldId : int
$details : mixed
$returnProperities : array<string|int, mixed> = NULL

An assoc array of fields that need to be returned, eg array( 'first_name', 'last_name').

Return values
object

an object of type referenced by daoName

commonSendMail()

Process that send notification e-mails

public static commonSendMail(int $contactID, array<string|int, mixed> &$values) : mixed
Parameters
$contactID : int

Contact id.

$values : array<string|int, mixed>

Associative array of name/value pair.

composeQuery()

Compose the query by merging the parameters into it.

public static composeQuery(string $query[, array<string|int, mixed> $params = [] ][, bool $abort = TRUE ]) : string
Parameters
$query : string
$params : array<string|int, mixed> = []
$abort : bool = TRUE
Tags
throws
CRM_Core_Exception
Return values
string

copy()

make a copy of a profile, including all the fields in the profile

public static copy(int $id) : CRM_Core_DAO
Parameters
$id : int

The profile id to copy.

Return values
CRM_Core_DAO

copyCustomFields()

Method that copies custom fields values from an old entity to a new one.

public copyCustomFields(int $entityID, int $newEntityID[, string $parentOperation = NULL ]) : mixed

Fixes bug CRM-19302, where if a custom field of File type was present, left both events using the same file, breaking download URL's for the old event.

Parameters
$entityID : int
$newEntityID : int
$parentOperation : string = NULL
Tags
todo

the goal here is to clean this up so that it works for any entity. Copy Generic already DOES some custom field stuff but it seems to be bypassed & perhaps less good than this (or this just duplicates it...)

copyGeneric()

Make a shallow copy of an object and all the fields in the object.

public static copyGeneric(string $daoName, array<string|int, mixed> $criteria[, array<string|int, mixed> $newData = NULL ][, string $fieldsFix = NULL ][, string $blockCopyOfDependencies = NULL ][, bool $blockCopyofCustomValues = FALSE ]) : CRM_Core_DAO|bool
Parameters
$daoName : string

Name of the dao.

$criteria : array<string|int, mixed>

Array of all the fields & values. on which basis to copy

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

Array of all the fields & values. to be copied besides the other fields

$fieldsFix : string = NULL

Array of fields that you want to prefix/suffix/replace.

$blockCopyOfDependencies : string = NULL

Fields that you want to block from. getting copied

$blockCopyofCustomValues : bool = FALSE

Case when you don't want to copy the custom values set in a template as it will override/ignore the submitted custom values

Return values
CRM_Core_DAO|bool

the newly created copy of the object. False if none created.

copyValues()

Given an associative array of name/value pairs, extract all the values that belong to this object and initialize the object with said values

public copyValues(array<string|int, mixed> $params) : bool
Parameters
$params : array<string|int, mixed>

Array of name/value pairs to save.

Return values
bool

Did we copy all null values into the object

createSQLFilter()

Get SQL where clause for SQL filter syntax input parameters.

public static createSQLFilter(string $fieldName, array<string|int, mixed> $filter[, string $type = NULL ][, string $alias = NULL ][, bool $returnSanitisedArray = FALSE ]) : null|string|array<string|int, mixed>

SQL version of api function to assign filters to the DAO based on the syntax $field => array('IN' => array(4,6,9)) OR $field => array('LIKE' => array('%me%)) etc

Parameters
$fieldName : string

Name of fields.

$filter : array<string|int, mixed>

filter to be applied indexed by operator.

$type : string = NULL

type of field (not actually used - nor in api @todo ).

$alias : string = NULL

alternative field name ('as') @todo- not actually used.

$returnSanitisedArray : bool = FALSE

Return a sanitised array instead of a clause. this is primarily so we can add filters @ the api level to the Query object based fields

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

a string is returned if $returnSanitisedArray is not set, otherwise and Array or NULL depending on whether it is supported as yet

createTestObject()

Creates a test object, including any required objects it needs via recursion createOnly: only create in database, do not store or return the objects (useful for perf testing) ONLY USE FOR TESTING

public static createTestObject(string $daoName[, array<string|int, mixed> $params = [] ][, int $numObjects = 1 ][, bool $createOnly = FALSE ]) : object|array<string|int, mixed>|null
Parameters
$daoName : string
$params : array<string|int, mixed> = []
$numObjects : int = 1
$createOnly : bool = FALSE
Return values
object|array<string|int, mixed>|null

NULL if $createOnly. A single object if $numObjects==1. Otherwise, an array of multiple objects.

createTriggers()

public static createTriggers(array<string|int, mixed> &$info[, string $onlyTableName = NULL ]) : mixed
Parameters
$info : array<string|int, mixed>

per hook_civicrm_triggerInfo.

$onlyTableName : string = NULL

the specific table requiring a rebuild; or NULL to rebuild all tables.

createUFJoin()

Make uf join entries for an uf group.

public static createUFJoin(int $weight, array<string|int, mixed> $groupTypes, int $ufGroupId) : mixed
Parameters
$weight : int
$groupTypes : array<string|int, mixed>

An assoc array of name/value pairs.

$ufGroupId : int

Ufgroup id.

debugPrint()

public static debugPrint([null $message = NULL ][, bool $printDAO = TRUE ]) : mixed
Parameters
$message : null = NULL
$printDAO : bool = TRUE

del()

Delete the profile Group.

public static del(int $id) : bool
Parameters
$id : int

Profile Id.

Return values
bool

delete()

Deletes items from table which match current objects variables.

public delete([bool $useWhere = FALSE ]) : int|false

Returns the true on success

for example

Designed to be extended

$object = new mytable(); $object->ID=123; echo $object->delete(); // builds a conditon

$object = new mytable(); $object->whereAdd('age > 12'); $object->limit(1); $object->orderBy('age DESC'); $object->delete(true); // dont use object vars, use the conditions, limit and order.

Parameters
$useWhere : bool = FALSE

(optional) If DB_DATAOBJECT_WHEREADD_ONLY is passed in then we will build the condition only using the whereAdd's. Default is to build the condition only using the object parameters.

Return values
int|false

Int (No. of rows affected) on success, false on failure, 0 on no data affected

deleteEntityContact()

Unused function.

public static deleteEntityContact(mixed $daoName, mixed $contactId) : mixed

in 5.47 will be removed in 5.80

Parameters
$daoName : mixed
$contactId : mixed

deleteRecord()

Delete a record from supplied params.

public static deleteRecord(array<string|int, mixed> $record) : static
Parameters
$record : array<string|int, mixed>

'id' is required.

Tags
throws
CRM_Core_Exception
Return values
static

deleteRecords()

Bulk delete multiple records.

public static deleteRecords(array<string|int, array<string|int, mixed>> $records) : array<string|int, static>
Parameters
$records : array<string|int, array<string|int, mixed>>
Tags
throws
CRM_Core_Exception
Return values
array<string|int, static>

deleteTestObjects()

Deletes the this object plus any dependent objects that are associated with it.

public static deleteTestObjects(string $daoName[, array<string|int, mixed> $params = [] ]) : mixed

ONLY USE FOR TESTING

Parameters
$daoName : string
$params : array<string|int, mixed> = []

delUFJoin()

Delete the uf join record for an uf group.

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

(reference) an assoc array of name/value pairs.

disableFullGroupByMode()

Disables usage of the ONLY_FULL_GROUP_BY Mode if necessary

public static disableFullGroupByMode() : mixed

dropAllTables()

Drop all CiviCRM tables.

public static dropAllTables() : mixed
Tags
throws
CRM_Core_Exception

dropTriggers()

Wrapper function to drop triggers.

public static dropTriggers([string $tableName = NULL ]) : mixed
Parameters
$tableName : string = NULL

the specific table requiring a rebuild; or NULL to rebuild all tables.

encodeGroupType()

Create a "group_type" string.

public static encodeGroupType(array<string|int, mixed> $coreTypes, array<string|int, mixed> $subTypes[, string $delim = CRM_Core_DAO::VALUE_SEPARATOR ]) : string
Parameters
$coreTypes : array<string|int, mixed>

E.g. array('Individual','Contact','Student').

$subTypes : array<string|int, mixed>

E.g. array('ActivityType' => array(7, 11)).

$delim : string = CRM_Core_DAO::VALUE_SEPARATOR
Tags
throws
CRM_Core_Exception
Return values
string

escapeString()

public static escapeString(mixed $string) : string
Parameters
$string : mixed
Return values
string

escapeStrings()

Escape a list of strings for use with "WHERE X IN (...)" queries.

public static escapeStrings(array<string|int, mixed> $strings[, string $default = NULL ]) : string
Parameters
$strings : array<string|int, mixed>
$default : string = NULL

the value to use if $strings has no elements.

Return values
string

eg "abc","def","ghi"

escapeWildCardString()

public static escapeWildCardString(mixed $string) : string
Parameters
$string : mixed
Return values
string

executeQuery()

Execute a query.

public static & executeQuery(string $query[, array<string|int, mixed> $params = [] ][, bool $abort = TRUE ][, null $daoName = NULL ][, bool $freeDAO = FALSE ][, bool $i18nRewrite = TRUE ][, bool $trapException = FALSE ][, array<string|int, mixed> $options = [] ]) : CRM_Core_DAO|object
Parameters
$query : string

Query to be executed.

$params : array<string|int, mixed> = []
$abort : bool = TRUE
$daoName : null = NULL
$freeDAO : bool = FALSE
$i18nRewrite : bool = TRUE
$trapException : bool = FALSE
$options : array<string|int, mixed> = []
Tags
throws
DBQueryException
Return values
CRM_Core_DAO|object

object that holds the results of the query NB - if this is defined as just returning a DAO phpstorm keeps pointing out all the properties that are not part of the DAO

executeUnbufferedQuery()

Execute an unbuffered query.

public static executeUnbufferedQuery(string $query[, array<string|int, mixed> $params = [] ][, bool $abort = TRUE ][, null $daoName = NULL ][, bool $freeDAO = FALSE ][, bool $i18nRewrite = TRUE ][, bool $trapException = FALSE ]) : CRM_Core_DAO

This is a wrapper around new functionality exposed with CRM-17748.

Parameters
$query : string

query to be executed

$params : array<string|int, mixed> = []
$abort : bool = TRUE
$daoName : null = NULL
$freeDAO : bool = FALSE
$i18nRewrite : bool = TRUE
$trapException : bool = FALSE
Return values
CRM_Core_DAO

Object that points to an unbuffered result set

export()

Returns the list of fields that can be exported

public static export([bool $prefix = FALSE ]) : array<string|int, mixed>
Parameters
$prefix : bool = FALSE
Return values
array<string|int, mixed>

fetchAll()

Returns all results as array-encoded records.

public fetchAll([mixed $k = FALSE ][, mixed $v = FALSE ][, mixed $method = FALSE ]) : array<string|int, mixed>
Parameters
$k : mixed = FALSE
$v : mixed = FALSE
$method : mixed = FALSE
Return values
array<string|int, mixed>

fetchGenerator()

Return the results as PHP generator.

public fetchGenerator([string $type = 'dao' ]) : mixed
Parameters
$type : string = 'dao'

Whether the generator yields 'dao' objects or 'array's.

fetchMap()

Get all the result records as mapping between columns.

public fetchMap(string $keyColumn, string $valueColumn) : array<string|int, mixed>
Parameters
$keyColumn : string

Ex: "name"

$valueColumn : string

Ex: "label"

Return values
array<string|int, mixed>

Ex: ["foo" => "The Foo Bar", "baz" => "The Baz Qux"]

fetchValue()

Returns a singular value.

public fetchValue() : mixed|null
Return values
mixed|null

fieldKeys()

Return a mapping from field-name to the corresponding key (as used in fields()).

public static fieldKeys() : array<string|int, mixed>
Return values
array<string|int, mixed>

[string $name => string $uniqueName]

fields()

Returns all the column names of this table.

public static & fields() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

fillValues()

Given an incomplete record, attempt to fill missing field values from the database

public static fillValues(array<string|int, mixed> $existingValues, mixed $fieldsToRetrieve) : array<string|int, mixed>
Parameters
$existingValues : array<string|int, mixed>
$fieldsToRetrieve : mixed
Return values
array<string|int, mixed>

filterUFGroups()

Filter ufgroups based on logged in user contact type.

public static filterUFGroups(int $ufGroupId[, int $contactID = NULL ]) : bool
Parameters
$ufGroupId : int

Uf group id (profile id).

$contactID : int = NULL
Return values
bool

true or false

findById()

Find a DAO object for the given ID and return it.

public static findById(int $id) : static
Parameters
$id : int

Id of the DAO object being searched for.

Tags
throws
Exception
Return values
static

Object of the type of the class that called this function.

findReferences()

Find all records which refer to this entity.

public findReferences() : array<string|int, CRM_Core_DAO>
Return values
array<string|int, CRM_Core_DAO>

formatFields()

Format fields for dupe Contact Matching.

public static formatFields(array<string|int, mixed> $params[, int $contactId = NULL ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>
$contactId : int = NULL
Return values
array<string|int, mixed>

associated formatted array

formatFieldValues()

Format field values according to fields() metadata.

public static formatFieldValues(array<string|int, mixed> &$fieldValues) : void

When fetching results from a query, every field is returned as a string. This function automatically converts them to the correct data type.

Parameters
$fieldValues : array<string|int, mixed>

formatUFFields()

Format a list of UFFields for use with buildProfile. This is the in-memory analog of getFields().

public static formatUFFields(array<string|int, mixed> $groupArr, array<string|int, mixed> $fieldArrs) : array<string|int, mixed>
Parameters
$groupArr : array<string|int, mixed>

(mimic CRM_UF_DAO_UFGroup).

$fieldArrs : array<string|int, mixed>
Tags
see
self::getFields
Return values
array<string|int, mixed>

freeResult()

public static freeResult([null $ids = NULL ]) : mixed
Parameters
$ids : null = NULL

getAttribute()

Get the size and maxLength attributes for this text field.

public static getAttribute(string $class[, string $fieldName = NULL ]) : array<string|int, mixed>

(or for all text fields) in the DAO object.

Parameters
$class : string

Name of DAO class.

$fieldName : string = NULL

Field that i'm interested in or null if. you want the attributes for all DAO text fields

Return values
array<string|int, mixed>

assoc array of name => attribute pairs

getBatchProfiles()

Get profiles used for batch entry.

public static getBatchProfiles() : array<string|int, mixed>
Return values
array<string|int, mixed>

profileIds profile ids

getConnection()

public static getConnection() : DB_common
Return values
DB_common

getContactIDsFromComponent()

Given the component id, compute the contact id since its used for things like send email

public static getContactIDsFromComponent(mixed $componentIDs, string $tableName[, string $idField = 'id' ]) : array<string|int, mixed>
Parameters
$componentIDs : mixed
$tableName : string
$idField : string = 'id'
Return values
array<string|int, mixed>

getContactType()

Retrieve the first non-generic contact type

public static getContactType(int $id) : string
Parameters
$id : int

Id of uf_group.

Return values
string

contact type

getDatabaseName()

Get the name of the CiviCRM database.

public static getDatabaseName() : string

use mysql DATABASE() within the query.

Return values
string

getDbVal()

Fetch a single field value from the database.

public static getDbVal(string $returnColumn, string|int $searchValue[, string $searchColumn = 'id' ]) : array<string|int, mixed>|bool|int|string|null

Uses static caching and applies formatting.

Parameters
$returnColumn : string
$searchValue : string|int
$searchColumn : string = 'id'
Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>|bool|int|string|null

Returned value will be formatted according to data type.

getDefaultFallbackValues()

Callback for `default_fallback` field values

public static getDefaultFallbackValues(array<string|int, mixed> $record, string $entityName, string $fieldName, array<string|int, mixed> $field) : mixed
Parameters
$record : array<string|int, mixed>
$entityName : string
$fieldName : string
$field : array<string|int, mixed>

getDoubleOptInGroupIds()

Alter contact params by filtering existing subscribed groups and returns unsubscribed groups array for subscription.

public static getDoubleOptInGroupIds(array<string|int, mixed> &$params[, int $contactId = NULL ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

Contact params.

$contactId : int = NULL

User contact id.

Return values
array<string|int, mixed>

This contains array of groups for subscription

getDynamicReferencesToTable()

Get all dynamic references to the given table.

public static getDynamicReferencesToTable(string $tableName) : array<string|int, mixed>
Parameters
$tableName : string
Return values
array<string|int, mixed>

getEditHTML()

Get the html for the form that represents this particular group.

public static getEditHTML(int $userID, string $title[, int $action = NULL ][, bool $register = FALSE ][, bool $reset = FALSE ][, int $profileID = NULL ][, bool $doNotProcess = FALSE ][, null $ctype = NULL ]) : string
Parameters
$userID : int

The user id that we are actually editing.

$title : string

The title of the group we are interested in.

$action : int = NULL

The action of the form.

$register : bool = FALSE

Is this the registration form.

$reset : bool = FALSE

Should we reset the form?.

$profileID : int = NULL

Do we have the profile ID?.

$doNotProcess : bool = FALSE
$ctype : null = NULL
Return values
string

the html for the form on success, otherwise empty string

getEntityDescription()

Returns user-friendly description of this entity.

public static getEntityDescription() : string|null
Tags
inheritDoc
Return values
string|null

getEntityIcon()

Overridable function to get icon for a particular entity.

public static getEntityIcon(string $entityName[, int|null $entityId = NULL ]) : string|null
Parameters
$entityName : string

Short name of the entity. This may seem redundant because the entity name can usually be inferred from the BAO class being called, but not always. Some virtual entities share a BAO class.

$entityId : int|null = NULL

Id of the entity.

Tags
inheritDoc
Return values
string|null

getEntityPaths()

Returns system paths related to this entity (as defined in the xml schema)

public static getEntityPaths() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

getEntityRefFilters()

public static getEntityRefFilters() : array<string|int, mixed>
Return values
array<string|int, mixed>

getEntityTitle()

Returns localized title of this entity.

public static getEntityTitle([mixed $plural = FALSE ]) : string
Parameters
$plural : mixed = FALSE
Return values
string

getExportableFieldsWithPseudoConstants()

Get exportable fields with pseudoconstants rendered as an extra field.

public static getExportableFieldsWithPseudoConstants(string $baoClass) : array<string|int, mixed>
Parameters
$baoClass : string
Return values
array<string|int, mixed>

getExtensionName()

Get name of extension in which this DAO is defined.

public static getExtensionName() : string|null
Tags
inheritDoc
Return values
string|null

getFields()

Get all the fields that belong to the group with the name title, and format for use with buildProfile. This is the SQL analog of formatUFFields().

public static getFields(int $id[, bool|int $register = FALSE ][, int $action = NULL ][, int $visibility = NULL ][, bool $searchable = FALSE ][, bool $showAll = FALSE ][, string $restrict = NULL ][, bool $skipPermission = FALSE ][, null $ctype = NULL ][, int $permissionType = CRM_Core_Permission::CREATE ][, string $orderBy = 'field_name' ][, bool $orderProfiles = FALSE ][, bool $eventProfile = FALSE ]) : array<string|int, mixed>
Parameters
$id : int

The id of the UF group or ids of ufgroup.

$register : bool|int = FALSE

are we interested in registration fields

$action : int = NULL

What action are we doing.

$visibility : int = NULL

Visibility of fields we are interested in.

$searchable : bool = FALSE
$showAll : bool = FALSE
$restrict : string = NULL

Should we restrict based on a specified profile type.

$skipPermission : bool = FALSE
$ctype : null = NULL
$permissionType : int = CRM_Core_Permission::CREATE
$orderBy : string = 'field_name'
$orderProfiles : bool = FALSE
$eventProfile : bool = FALSE
Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>

The fields that belong to this ufgroup(s)

getFieldSpec()

public getFieldSpec(string $fieldName) : bool|array<string|int, mixed>
Parameters
$fieldName : string
Return values
bool|array<string|int, mixed>

getFieldValue()

Given a DAO name, a column name and a column value, find the record and GET the value of another column in that record

public static getFieldValue(string $daoName, int $searchValue[, string $returnColumn = 'name' ][, string $searchColumn = 'id' ][, bool $force = FALSE ]) : string|int|null
Parameters
$daoName : string

Name of the DAO (Example: CRM_Contact_DAO_Contact to retrieve value from a contact).

$searchValue : int

Value of the column you want to search by.

$returnColumn : string = 'name'

Name of the column you want to GET the value of.

$searchColumn : string = 'id'

Name of the column you want to search by.

$force : bool = FALSE

Skip use of the cache.

Tags
throws
CRM_Core_Exception
Return values
string|int|null

Value of $returnColumn in the retrieved record

getFrontEndTitle()

Get the frontend_title for the profile, falling back on 'title' if none.

public static getFrontEndTitle(int $profileID) : string
Parameters
$profileID : int
Tags
throws
CRM_Core_Exception
Return values
string

getGlobalSetting()

Lookup the value of a MySQL global configuration variable.

public static getGlobalSetting(string $name[, mixed $default = NULL ]) : mixed
Parameters
$name : string

E.g. "thread_stack".

$default : mixed = NULL

getLabelField()

public static getLabelField() : string|null
Return values
string|null

getListingFields()

Get all the listing fields.

public static getListingFields(int $action, int $visibility[, bool $considerSelector = FALSE ][, array<string|int, mixed> $ufGroupIds = NULL ][, bool $searchable = NULL ][, null $restrict = NULL ][, bool $skipPermission = FALSE ][, int $permissionType = CRM_Core_Permission::SEARCH ]) : array<string|int, mixed>
Parameters
$action : int

What action are we doing.

$visibility : int

Visibility of fields we are interested in.

$considerSelector : bool = FALSE

Whether to consider the in_selector parameter.

$ufGroupIds : array<string|int, mixed> = NULL
$searchable : bool = NULL
$restrict : null = NULL
$skipPermission : bool = FALSE
$permissionType : int = CRM_Core_Permission::SEARCH
Tags
throws
Exception
Return values
array<string|int, mixed>

the fields that are listings related

getLocaleTableName()

Get localized name of this table, if applicable.

public static getLocaleTableName([string|null $tableName = NULL ]) : string

If this is a multi-language installation and the table has localized columns, will return table name with language string appended, which points to a sql view. Otherwise, this returns the same output as

Parameters
$tableName : string|null = NULL

Unnecessary deprecated param

Tags
see
self::getTableName()
Return values
string

getLocationFields()

Get the fields relating to locations.

public static getLocationFields() : array<string|int, mixed>
Return values
array<string|int, mixed>

getLog()

Returns if this table needs to be logged

public getLog() : bool
Tags
inheritDoc
Return values
bool

getModuleUFGroup()

Get the uf group for a module.

public static getModuleUFGroup([string $moduleName = NULL ][, int $count = 0 ][, bool $skipPermission = TRUE ][, int $op = CRM_Core_Permission::VIEW ][, array<string|int, mixed>|null $returnFields = NULL ]) : array<string|int, mixed>
Parameters
$moduleName : string = NULL

Module name.

$count : int = 0

No to increment the weight.

$skipPermission : bool = TRUE
$op : int = CRM_Core_Permission::VIEW

Which operation (view, edit, create, etc) to check permission for.

$returnFields : array<string|int, mixed>|null = NULL
Return values
array<string|int, mixed>

array of ufgroups for a module

getOptionLabels()

Populate option labels for this object's fields.

public getOptionLabels() : mixed
Tags
throws
exception

if called directly on the base class

getProfiles()

Get profiles by type eg: pure Individual etc

public static getProfiles(array<string|int, mixed> $types[, bool $onlyPure = FALSE ]) : array<string|int, mixed>
Parameters
$types : array<string|int, mixed>

Associative array of types eg: types('Individual').

$onlyPure : bool = FALSE

True if only pure profiles are required.

Return values
array<string|int, mixed>

associative array of profiles

getReferenceCounts()

public getReferenceCounts() : array<string|int, array{name: string, type: string, count: int, table: string|null, key: string|null}>
Return values
array<string|int, array{name: string, type: string, count: int, table: string|null, key: string|null}>

each item has keys:

  • name: string
  • type: string
  • count: int
  • table: string|null SQL table name
  • key: string|null SQL column name

getReferencesToContactTable()

Get all references to contact table.

public static getReferencesToContactTable() : mixed

This includes core tables, custom group tables, tables added by the merge hook and the entity_tag table.

Refer to CRM-17454 for information on the danger of querying the information schema to derive this.

Tags
throws
CRM_Core_Exception

getReferencesToTable()

List all tables which have either: - hard foreign keys to this table, or - a dynamic foreign key that includes this table as a possible target.

public static getReferencesToTable(string $tableName) : array<string|int, CRM_Core_Reference_Interface>
Parameters
$tableName : string

Table referred to.

Return values
array<string|int, CRM_Core_Reference_Interface>

structure of table and column, listing every table with a foreign key reference to $tableName, and the column where the key appears.

getRegistrationFields()

Get all the registration fields.

public static getRegistrationFields(int $action, int $mode[, string $ctype = NULL ]) : array<string|int, mixed>
Parameters
$action : int

What action are we doing.

$mode : int

Mode.

$ctype : string = NULL
Tags
throws
Exception
Return values
array<string|int, mixed>

the fields that are needed for registration

getSelectWhereClause()

This returns the final permissioned query string for this entity

public static getSelectWhereClause([string|null $tableAlias = NULL ][, string|null $entityName = NULL ][, array<string|int, mixed> $conditions = [] ]) : array<string|int, mixed>

With acls from related entities + additional clauses from hook_civicrm_selectWhereClause

DO NOT OVERRIDE THIS FUNCTION

Parameters
$tableAlias : string|null = NULL
$entityName : string|null = NULL
$conditions : array<string|int, mixed> = []

Values from WHERE or ON clause

Tags
TODO:

ADD final keyword to function signature

Return values
array<string|int, mixed>

getSortString()

Unused function.

public static getSortString(mixed $sort[, mixed $default = NULL ]) : mixed

in 5.72 will be removed in 5.85

Parameters
$sort : mixed
$default : mixed = NULL

getSupportedFields()

Returns all usable fields, indexed by name.

public static getSupportedFields([bool $checkPermissions = FALSE ]) : array<string|int, mixed>

This function differs from fields() in that it indexes by name rather than unique_name.

It excludes fields not added yet by pending upgrades. This avoids problems with trying to SELECT a field that exists in code but has not yet been added to the db.

Parameters
$checkPermissions : bool = FALSE

Filter by field permissions.

Return values
array<string|int, mixed>

getTableName()

Returns the name of this table

public static getTableName() : string
Tags
inheritDoc
Return values
string

getTableNames()

Gets the names of all enabled schema tables.

public static getTableNames() : array<string|int, mixed>
  • Includes tables from core, components & enabled extensions.
  • Excludes log tables, temp tables, and missing/disabled extensions.
Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>

getTitle()

Get the form title.

public static getTitle(int $id) : string
Parameters
$id : int

Id of uf_form.

Return values
string

title

getUFJoinRecord()

Get the UF Join records for an ufgroup id.

public static getUFJoinRecord([int $ufGroupId = NULL ][, int $displayName = NULL ][, int $status = NULL ]) : array<string|int, mixed>
Parameters
$ufGroupId : int = NULL

Uf group id.

$displayName : int = NULL

If set return display name in array.

$status : int = NULL

If set return module other than default modules (User Account/User registration/Profile).

Return values
array<string|int, mixed>

getValidProfiles()

Check whether a profile is valid combination of required and/or optional profile types

public static getValidProfiles(array<string|int, mixed> $required[, array<string|int, mixed> $optional = NULL ]) : array<string|int, mixed>
Parameters
$required : array<string|int, mixed>

Array of types those are required.

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

Array of types those are optional.

Return values
array<string|int, mixed>

associative array of profiles

getValues()

Given a contact id and a field set, return the values from the db.

public static getValues(int $cid, array<string|int, mixed> &$fields, array<string|int, mixed> &$values[, bool $searchable = TRUE ][, array<string|int, mixed> $componentWhere = NULL ][, bool $absolute = FALSE ][, null $additionalWhereClause = NULL ]) : null|array<string|int, mixed>
Parameters
$cid : int
$fields : array<string|int, mixed>

The profile fields of interest.

$values : array<string|int, mixed>

The values for the above fields.

$searchable : bool = TRUE

Searchable or not.

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

Component condition.

$absolute : bool = FALSE

Return urls in absolute form (useful when sending an email).

$additionalWhereClause : null = NULL
Return values
null|array<string|int, mixed>

getWeight()

Get the weight for ufjoin record.

public static getWeight([int $ufGroupId = NULL ]) : int
Parameters
$ufGroupId : int = NULL

If $ufGroupId get update weight or add weight.

Return values
int

weight of the UFGroup

groupTypeValues()

Get group type values of the profile.

public static groupTypeValues(int $profileId[, string $groupType = NULL ]) : array<string|int, mixed>
Parameters
$profileId : int
$groupType : string = NULL
Return values
array<string|int, mixed>

group type values

import()

Returns the list of fields that can be imported

public static import([bool $prefix = FALSE ]) : array<string|int, mixed>
Parameters
$prefix : bool = FALSE
Return values
array<string|int, mixed>

indices()

public static indices([bool $localize = TRUE ]) : array<string|int, mixed>
Parameters
$localize : bool = TRUE
Tags
inheritDoc
Return values
array<string|int, mixed>

init()

Initialize the DAO object.

public static init(string $dsn) : mixed
Parameters
$dsn : string

The database connection string.

initialize()

Initialization for all DAO objects. Since we access DB_DO programatically we need to set the links manually.

public initialize() : mixed

isComponentEnabled()

Check if component is enabled for this DAO class

public static isComponentEnabled() : bool
Return values
bool

isDBMyISAM()

public static isDBMyISAM([int $maxTablesToCheck = 10 ]) : bool
Parameters
$maxTablesToCheck : int = 10
Return values
bool

isProfileAddToGroupDoubleOptin()

public static isProfileAddToGroupDoubleOptin() : bool|object
Return values
bool|object

isProfileDoubleOptin()

public static isProfileDoubleOptin() : bool|object
Return values
bool|object

isValid()

Check the data validity.

public static isValid(int $userID, string $name[, bool $register = FALSE ][, int $action = NULL ]) : bool
Parameters
$userID : int

The user id that we are actually editing.

$name : string

The machine-name of the group we are interested in.

$register : bool = FALSE
$action : int = NULL

The action of the form.

Tags
pram

boolean $register is this the registrtion form

Return values
bool

true if form is valid

isValidOption()

Wrapper to validate internal DAO options before passing to DB_mysql/DB_Common level

public isValidOption(array<string|int, mixed> $options) : bool
Parameters
$options : array<string|int, mixed>
Return values
bool

Provided options are valid

keys()

Returns primary keys (usually ['id'])

public keys() : array<string|int, string>
Tags
inheritDoc
Return values
array<string|int, string>

log()

public log([bool $created = FALSE ]) : mixed
Parameters
$created : bool = FALSE

makeAttribute()

Create an attribute for this specific field. We only do this for strings and text

public static makeAttribute(array<string|int, mixed> $field) : array<string|int, mixed>|null
Parameters
$field : array<string|int, mixed>

The field under task.

Return values
array<string|int, mixed>|null

the attributes for the object

objectExists()

Check if there is a record with the same name in the db.

public static objectExists(string $value, string $daoName, string $daoID[, string $fieldName = 'name' ][, string $domainID = NULL ]) : bool
Parameters
$value : string

The value of the field we are checking.

$daoName : string

The dao object name.

$daoID : string

The id of the object being updated. u can change your name. as long as there is no conflict

$fieldName : string = 'name'

The name of the field in the DAO.

$domainID : string = NULL

The id of the domain. Object exists only for the given domain.

Return values
bool

true if object exists

profileGroups()

Retrieve groups of profiles.

public static profileGroups(int $profileID) : array<string|int, mixed>
Parameters
$profileID : int

Id of the profile.

Return values
array<string|int, mixed>

returns array

query()

Execute a query by the current DAO, localizing it along the way (if needed).

public query(string $query[, bool $i18nRewrite = TRUE ]) : object
Parameters
$query : string

The SQL query for execution.

$i18nRewrite : bool = TRUE

Whether to rewrite the query.

Return values
object

the current DAO object after the query execution

reenableFullGroupByMode()

Re-enables ONLY_FULL_GROUP_BY sql_mode as necessary.

public static reenableFullGroupByMode() : mixed

.

reformatProfileFields()

This is function is used to format pseudo fields.

public static reformatProfileFields(array<string|int, mixed> &$fields) : mixed
Parameters
$fields : array<string|int, mixed>

Associated array of profile fields.

requireSafeDBName()

ensure database name is 'safe', i.e. only contains word characters (includes underscores) and dashes, and contains at least one [a-z] case insensitive.

public static requireSafeDBName(mixed $database) : bool
Parameters
$database : mixed
Return values
bool

reset()

Reset the DAO object.

public reset() : mixed

DAO is kinda crappy in that there is an unwritten rule of one query per DAO.

We attempt to get around this crappy restriction by resetting some of DAO's internal fields. Use this with caution

retrieve()

Fetch object based on array of properties.

public static retrieve(array<string|int, mixed> &$params, array<string|int, mixed> &$defaults) : object
Parameters
$params : array<string|int, mixed>

(reference) an assoc array of name/value pairs.

$defaults : array<string|int, mixed>

(reference) an assoc array to hold the flattened values.

Return values
object

CRM_Core_DAO_UFGroup object

schemaRequiresRebuilding()

Checks if CONSTRAINT keyword exists for a specified table.

public static schemaRequiresRebuilding([mixed $tables = ["civicrm_contact"] ]) : mixed

in 5.72 will be removed in 5.85

Parameters
$tables : mixed = ["civicrm_contact"]

sequenceKey()

Tells DB_DataObject which keys use autoincrement.

public sequenceKey() : array<string|int, mixed>

'id' is autoincrementing by default.

FIXME: this should return all autoincrement keys not just the first.

Return values
array<string|int, mixed>

serializeField()

Transform an array to a serialized string for database storage.

public static serializeField(array<string|int, mixed>|null $value, int $serializationType) : string|null
Parameters
$value : array<string|int, mixed>|null
$serializationType : int
Tags
throws
Exception
Return values
string|null

setApiFilter()

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

setComponentDefaults()

setDefault component specific profile fields.

public static setComponentDefaults(array<string|int, mixed> &$fields, int $componentId, string $component, array<string|int, mixed> &$defaults[, bool $isStandalone = FALSE ]) : mixed
Parameters
$fields : array<string|int, mixed>

Profile fields.

$componentId : int

ComponetID.

$component : string

Component name.

$defaults : array<string|int, mixed>

An array of default values.

$isStandalone : bool = FALSE

setCreateDefaults()

Set defaults when creating new entity.

public static setCreateDefaults(array<string|int, mixed> &$params, mixed $defaults) : mixed

(don't call this set defaults as already in use with different signature in some places)

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

setFieldValue()

Given a DAO name, a column name and a column value, find the record and SET the value of another column in that record

public static setFieldValue(string $daoName, int $searchValue, string $setColumn, string $setValue[, string $searchColumn = 'id' ]) : bool
Parameters
$daoName : string

Name of the DAO (Example: CRM_Contact_DAO_Contact to retrieve value from a contact).

$searchValue : int

Value of the column you want to search by.

$setColumn : string

Name of the column you want to SET the value of.

$setValue : string

SET the setColumn to this value.

$searchColumn : string = 'id'

Name of the column you want to search by.

Return values
bool

true if we found and updated the object, else false

setIsActive()

public static setIsActive(int $id, bool $is_active) : bool
  • this bypasses hooks.
Parameters
$id : int
$is_active : bool
Return values
bool

setOptions()

https://issues.civicrm.org/jira/browse/CRM-17748 Sets the internal options to be used on a query

public setOptions(array<string|int, mixed> $options) : mixed
Parameters
$options : array<string|int, mixed>

setProfileDefaults()

Set profile defaults.

public static setProfileDefaults(int $contactId, array<string|int, mixed> &$fields, array<string|int, mixed> &$defaults[, bool $singleProfile = TRUE ][, int $componentId = NULL ][, null $component = NULL ]) : mixed
Parameters
$contactId : int

Contact id.

$fields : array<string|int, mixed>

Associative array of fields.

$defaults : array<string|int, mixed>

Defaults array.

$singleProfile : bool = TRUE

True for single profile else false(Update multiple items).

$componentId : int = NULL

Id for specific components like contribute, event etc.

$component : null = NULL

setRegisterDefaults()

Get default value for Register.

public static setRegisterDefaults(array<string|int, mixed> &$fields, array<string|int, mixed> &$defaults) : array<string|int, mixed>
Parameters
$fields : array<string|int, mixed>
$defaults : array<string|int, mixed>
Return values
array<string|int, mixed>

shiftMultiRecordFields()

public static shiftMultiRecordFields(mixed &$source, mixed &$destination[, bool $returnMultiSummaryFields = FALSE ]) : array<string|int, mixed>|null
Parameters
$source : mixed
$destination : mixed
$returnMultiSummaryFields : bool = FALSE
Tags
todo

what do I do?

Return values
array<string|int, mixed>|null

shortenSQLName()

SQL has a limit of 64 characters on various names: table name, trigger name, column name ... For custom groups and fields we generated names from user entered input which can be longer than this length, this function helps with creating strings that meet various criteria.

public static shortenSQLName(string $string[, int $length = 60 ][, bool $makeRandom = FALSE ]) : string
Parameters
$string : string

The string to be shortened.

$length : int = 60

The max length of the string.

$makeRandom : bool = FALSE
Return values
string

showOverlayProfile()

Determine of we show overlay profile or not.

public static showOverlayProfile() : bool
Return values
bool

true if profile should be shown else false

singleValueQuery()

Execute a query and get the single result.

public static & singleValueQuery(string $query[, array<string|int, mixed> $params = [] ][, bool $abort = TRUE ][, bool $i18nRewrite = TRUE ]) : string|null
Parameters
$query : string

Query to be executed.

$params : array<string|int, mixed> = []
$abort : bool = TRUE
$i18nRewrite : bool = TRUE
Tags
throws
CRM_Core_Exception
Return values
string|null

the result of the query if any

storeValues()

Store all the values from this object in an associative array this is a destructive store, calling function is responsible for keeping sanity of id's.

public static storeValues(object &$object, array<string|int, mixed> &$values) : mixed
Parameters
$object : object

The object that we are extracting data from.

$values : array<string|int, mixed>

(reference ) associative array of name/value pairs.

table()

Get/set an associative array of table columns

public table() : array<string|int, mixed>
Return values
array<string|int, mixed>

(associative)

tableHasBeenAdded()

Checks if this DAO's table ought to exist.

public static tableHasBeenAdded() : bool

If there are pending DB updates, this function compares the CiviCRM version of the table to the current schema version.

Tags
throws
CRM_Core_Exception
Return values
bool

triggerRebuild()

Build a list of triggers via hook and add them to (err, reconcile them with) the database.

public static triggerRebuild([string $tableName = NULL ][, bool $force = FALSE ]) : mixed
Parameters
$tableName : string = NULL

the specific table requiring a rebuild; or NULL to rebuild all tables.

$force : bool = FALSE
Tags
see

CRM-9716

unSerializeField()

Transform a serialized string from the database into an array.

public static unSerializeField(string|null $value, mixed $serializationType) : array<string|int, mixed>|null
Parameters
$value : string|null
$serializationType : mixed
Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>|null

updateGroupTypes()

Update the profile type 'group_type' as per profile fields including group types and group subtype values.

public static updateGroupTypes(int $gId[, array<string|int, mixed> $groupTypes = [] ]) : bool

Build and store string like: group_type1,group_type2[VALUE_SEPARATOR]group_type1Type:1:2:3,group_type2Type:1:2

FIELDS GROUP_TYPE BirthDate + Email Individual,Contact BirthDate + Subject Individual,Activity BirthDate + Subject + SurveyOnlyField Individual,Activity\0ActivityType:28 BirthDate + Subject + SurveyOnlyField + PhoneOnlyField (Not allowed) BirthDate + SurveyOnlyField Individual,Activity\0ActivityType:28 BirthDate + Subject + SurveyOrPhoneField Individual,Activity\0ActivityType:2:28 BirthDate + SurveyOrPhoneField Individual,Activity\0ActivityType:2:28 BirthDate + SurveyOrPhoneField + SurveyOnlyField Individual,Activity\0ActivityType:2:28 BirthDate + StudentField + Subject + SurveyOnlyField Individual,Activity,Student\0ActivityType:28

Parameters
$gId : int
$groupTypes : array<string|int, mixed> = []

With key having group type names.

Return values
bool

usedByModule()

Check if profile Group used by any module.

public static usedByModule(int $id) : bool
Parameters
$id : int

Profile Id.

Return values
bool

writeRecord()

Create or update a record from supplied params.

public static writeRecord(array<string|int, mixed> $record) : static

If 'id' is supplied, an existing record will be updated Otherwise a new record will be created.

Parameters
$record : array<string|int, mixed>
Tags
throws
CRM_Core_Exception
Return values
static

writeRecords()

Bulk save multiple records

public static writeRecords(array<string|int, array<string|int, mixed>> $records) : array<string|int, static>
Parameters
$records : array<string|int, array<string|int, mixed>>
Tags
throws
CRM_Core_Exception
Return values
array<string|int, static>

_setDBOptions()

https://issues.civicrm.org/jira/browse/CRM-17748 wrapper to pass internal DAO options down to DB_mysql/DB_Common level

protected _setDBOptions(array<string|int, mixed> $options) : mixed
Parameters
$options : array<string|int, mixed>

assignTestFK()

protected assignTestFK(string $fieldName, mixed $fieldDef, array<string|int, mixed> $params) : mixed
Parameters
$fieldName : string
$fieldDef : mixed
$params : array<string|int, mixed>

assignTestValue()

Generate and assign an arbitrary value to a field of a test object.

protected assignTestValue(string $fieldName, array<string|int, mixed> &$fieldDef, int $counter) : mixed
Parameters
$fieldName : string
$fieldDef : array<string|int, mixed>
$counter : int

The globally-unique ID of the test object.

Tags
throws
CRM_Core_Exception

copyLocalizable()

Method that copies localizable fields from an old entity to a new one.

protected copyLocalizable(int $entityID, int $newEntityID, array<string|int, mixed> $fieldsToPrefix, array<string|int, mixed> $fieldsToSuffix, array<string|int, mixed> $fieldsToReplace) : mixed

Fixes bug dev/core#2479, where non current locale fields are copied from current locale losing translation when copying

Parameters
$entityID : int
$newEntityID : int
$fieldsToPrefix : array<string|int, mixed>
$fieldsToSuffix : array<string|int, mixed>
$fieldsToReplace : array<string|int, mixed>

createUFFieldQuery()

Create a query to find all visible UFFields in a UFGroup.

protected static createUFFieldQuery(int $groupId, bool $searchable, bool $showAll, int $visibility, string $orderBy) : string

This is the SQL-variant of checkUFFieldDisplayable().

Parameters
$groupId : int
$searchable : bool
$showAll : bool
$visibility : int
$orderBy : string

Comma-delimited list of SQL columns.

Return values
string

formatFieldValue()

Format a value according to field metadata.

protected static formatFieldValue(string|null $value, array<string|int, mixed>|null $fieldSpec) : mixed
Parameters
$value : string|null
$fieldSpec : array<string|int, mixed>|null

formatUFField()

Prepare a field for rendering with CRM_Core_BAO_UFGroup::buildProfile.

protected static formatUFField(CRM_Core_DAO_UFGroup|CRM_Core_DAO $group, CRM_Core_DAO_UFField|CRM_Core_DAO $field, array<string|int, mixed> $customFields, array<string|int, mixed> $addressCustomFields, array<string|int, mixed> $importableFields[, int $permissionType = CRM_Core_Permission::CREATE ]) : array<string|int, mixed>
Parameters
$group : CRM_Core_DAO_UFGroup|CRM_Core_DAO
$field : CRM_Core_DAO_UFField|CRM_Core_DAO
$customFields : array<string|int, mixed>
$addressCustomFields : array<string|int, mixed>
$importableFields : array<string|int, mixed>
$permissionType : int = CRM_Core_Permission::CREATE

Eg CRM_Core_Permission::CREATE.

Return values
array<string|int, mixed>

getCustomFields()

protected static getCustomFields(mixed $ctype[, int|null $checkPermission = CRM_Core_Permission::VIEW ]) : array<string|int, mixed>
Parameters
$ctype : mixed
$checkPermission : int|null = CRM_Core_Permission::VIEW
Return values
array<string|int, mixed>

getDynamicFkAclClauses()

Get an array of ACL clauses for a dynamic FK (entity_id/entity_table combo)

protected static getDynamicFkAclClauses(string $entityTableField, string $entityIdField[, mixed|null $entityTableValues = NULL ]) : array<string|int, mixed>
Parameters
$entityTableField : string
$entityIdField : string
$entityTableValues : mixed|null = NULL
Return values
array<string|int, mixed>

getFirstPrimaryKey()

protected getFirstPrimaryKey() : string
Return values
string

getImportableFields()

Get a list of filtered field metadata.

protected static getImportableFields(mixed $showAll, mixed $profileType, mixed $contactActivityProfile[, bool $filterMode = TRUE ]) : array<string|int, mixed>

use getProfileFieldMetadata

Parameters
$showAll : mixed
$profileType : mixed
$contactActivityProfile : mixed
$filterMode : bool = TRUE

Filter mode means you are using importable fields for filtering rather than just getting metadata. With filter mode = FALSE BOTH activity fields and component fields are returned. I can't see why you would ever want to use this function in filter mode as the component fields are still unfiltered. However, I feel scared enough to leave it as it is. I have marked this function as deprecated and am recommending the wrapper 'getProfileFieldMetadata' in order to try to send this confusion to history.

Return values
array<string|int, mixed>

getProfileFieldMetadata()

Get the metadata for all potential profile fields.

protected static getProfileFieldMetadata(bool $isIncludeInactive) : array<string|int, mixed>
Parameters
$isIncludeInactive : bool

Should disabled fields be included.

Return values
array<string|int, mixed>

Field metadata for all fields that might potentially be in a profile.

getTableAddVersion()

protected static getTableAddVersion() : string
Tags
inheritDoc
Return values
string

Version in which table was added

clearDbColumnValueCache()

Remove item from static cache during update/delete operations

private clearDbColumnValueCache() : mixed

formatCustomValue()

Format custom field value for use in prepopulating a quickform profile field.

private static formatCustomValue(array<string|int, mixed> $field, string $value) : mixed
Parameters
$field : array<string|int, mixed>

Field metadata.

$value : string

Raw value

Return values
mixed

String or array, depending on the html type

getEntityDefinition()

private static getEntityDefinition() : array<string|int, mixed>
Return values
array<string|int, mixed>

getEntityInfo()

private static getEntityInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>

getFieldLength()

private static getFieldLength(mixed $sqlType) : string|null
Parameters
$sqlType : mixed
Return values
string|null

getSchemaFields()

private static getSchemaFields() : array<string|int, mixed>
Return values
array<string|int, mixed>

loadSchemaFields()

private static loadSchemaFields() : array<string|int, mixed>
Return values
array<string|int, mixed>

makeNameFromLabel()

When creating a record without a supplied name, create a unique, clean name derived from the label.

private makeNameFromLabel() : void

Note: this function does nothing unless a unique index exists for "name" column.

setDefaultsFromCallback()

Set default values for fields based on callback functions

private static setDefaultsFromCallback(string $entityName, array<string|int, mixed> &$record) : void
Parameters
$entityName : string

The entity name

$record : array<string|int, mixed>

The record array to set default values for


        
On this page

Search results