CRM_Core_Reference_Dynamic
extends CRM_Core_Reference_Basic
in package
Description of a one-way link between two entities
This is a generic, soft-foreign key based on a pair of columns (entity_id, entity_table).
Table of Contents
Properties
- $refKey : mixed
- $refTable : mixed
- $refTypeColumn : mixed
- $targetKey : mixed
- $targetTable : mixed
Methods
- __construct() : mixed
- findReferences() : CRM_Core_DAO
- Create a query to find references to a particular record.
- getReferenceCount() : array<string|int, mixed>
- Create a query to find references to a particular record.
- getReferenceKey() : string
- getReferenceTable() : string
- getTargetEntities() : array<string|int, mixed>
- Returns a list of all allowed values for $this->refTypeColumn
- getTargetKey() : string
- getTargetTable() : string
- getTypeColumn() : string|null
- CRM_Core_Reference_Basic returns NULL.
- matchesTargetTable() : bool
- Determine if a given table is a target of this reference.
- getQueryParams() : array<string|int, array<string|int, mixed>>
- Gets query params needed by the find reference query
Properties
$refKey
protected
mixed
$refKey
$refTable
protected
mixed
$refTable
$refTypeColumn
protected
mixed
$refTypeColumn
$targetKey
protected
mixed
$targetKey
$targetTable
protected
mixed
$targetTable
Methods
__construct()
public
__construct(string $refTable, string $refKey[, string $targetTable = NULL ][, string $targetKey = 'id' ][, string|null $refTypeColumn = NULL ]) : mixed
Parameters
- $refTable : string
- $refKey : string
- $targetTable : string = NULL
- $targetKey : string = 'id'
- $refTypeColumn : string|null = NULL
findReferences()
Create a query to find references to a particular record.
public
findReferences(CRM_Core_DAO $targetDao) : CRM_Core_DAO
Parameters
- $targetDao : CRM_Core_DAO
-
The instance for which we want references.
Return values
CRM_Core_DAO —a query-handle (like the result of CRM_Core_DAO::executeQuery)
getReferenceCount()
Create a query to find references to a particular record.
public
getReferenceCount(CRM_Core_DAO $targetDao) : array<string|int, mixed>
Parameters
- $targetDao : CRM_Core_DAO
Return values
array<string|int, mixed>getReferenceKey()
public
getReferenceKey() : string
Return values
stringgetReferenceTable()
public
getReferenceTable() : string
Return values
stringgetTargetEntities()
Returns a list of all allowed values for $this->refTypeColumn
public
getTargetEntities() : array<string|int, mixed>
Return values
array<string|int, mixed> —[ref_column_value => EntityName] Keys are the value stored in $this->refTypeColumn, Values are the name of the corresponding entity.
getTargetKey()
public
getTargetKey() : string
Return values
stringgetTargetTable()
public
getTargetTable() : string
Return values
stringgetTypeColumn()
CRM_Core_Reference_Basic returns NULL.
public
getTypeColumn() : string|null
CRM_Core_Reference_Dynamic returns the name of the dynamic column e.g. "entity_table".
Return values
string|nullmatchesTargetTable()
Determine if a given table is a target of this reference.
public
matchesTargetTable(string $tableName) : bool
Parameters
- $tableName : string
Return values
boolgetQueryParams()
Gets query params needed by the find reference query
private
getQueryParams(CRM_Core_DAO $targetDao) : array<string|int, array<string|int, mixed>>
Parameters
- $targetDao : CRM_Core_DAO