4 * Description of a one-way link between two entities
6 * This could be a foreign key or a generic (entity_id, entity_table) pointer
8 class CRM_Core_EntityReference
{
11 protected $refTypeColumn;
12 protected $targetTable;
15 function __construct($refTable, $refKey, $targetTable = NULL, $targetKey = 'id', $refTypeColumn = NULL) {
16 $this->refTable
= $refTable;
17 $this->refKey
= $refKey;
18 $this->targetTable
= $targetTable;
19 $this->targetKey
= $targetKey;
20 $this->refTypeColumn
= $refTypeColumn;
23 function getReferenceTable() {
24 return $this->refTable
;
27 function getReferenceKey() {
31 function getTypeColumn() {
32 return $this->refTypeColumn
;
35 function getTargetTable() {
36 return $this->targetTable
;
39 function getTargetKey() {
40 return $this->targetKey
;
44 * @return true if the reference can point to more than one type
46 function isGeneric() {
47 return ($this->refTypeColumn
!== NULL);