5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Case/CaseContact.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:8ccb7c478dfa4eb1b3b022eeabc71b79)
13 * Database access object for the CaseContact entity.
15 class CRM_Case_DAO_CaseContact
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '2.1';
18 const COMPONENT
= 'CiviCase';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_case_contact';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = TRUE;
35 * Unique case-contact association id
42 * Case ID of case-contact association.
49 * Contact ID of contact record given case belongs to.
58 public function __construct() {
59 $this->__table
= 'civicrm_case_contact';
60 parent
::__construct();
64 * Returns localized title of this entity.
67 * Whether to return the plural version of the title.
69 public static function getEntityTitle($plural = FALSE) {
70 return $plural ?
ts('Case Contacts') : ts('Case Contact');
74 * Returns foreign keys and entity references.
77 * [CRM_Core_Reference_Interface]
79 public static function getReferenceColumns() {
80 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
81 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
82 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'case_id', 'civicrm_case', 'id');
83 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
84 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
86 return Civi
::$statics[__CLASS__
]['links'];
90 * Returns all the column names of this table
94 public static function &fields() {
95 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
96 Civi
::$statics[__CLASS__
]['fields'] = [
99 'type' => CRM_Utils_Type
::T_INT
,
100 'title' => ts('Case Contact ID'),
101 'description' => ts('Unique case-contact association id'),
103 'where' => 'civicrm_case_contact.id',
104 'table_name' => 'civicrm_case_contact',
105 'entity' => 'CaseContact',
106 'bao' => 'CRM_Case_BAO_CaseContact',
112 'type' => CRM_Utils_Type
::T_INT
,
113 'title' => ts('Case'),
114 'description' => ts('Case ID of case-contact association.'),
116 'where' => 'civicrm_case_contact.case_id',
117 'table_name' => 'civicrm_case_contact',
118 'entity' => 'CaseContact',
119 'bao' => 'CRM_Case_BAO_CaseContact',
121 'FKClassName' => 'CRM_Case_DAO_Case',
125 'name' => 'contact_id',
126 'type' => CRM_Utils_Type
::T_INT
,
127 'title' => ts('Contact ID'),
128 'description' => ts('Contact ID of contact record given case belongs to.'),
130 'where' => 'civicrm_case_contact.contact_id',
131 'table_name' => 'civicrm_case_contact',
132 'entity' => 'CaseContact',
133 'bao' => 'CRM_Case_BAO_CaseContact',
135 'FKClassName' => 'CRM_Contact_DAO_Contact',
137 'type' => 'EntityRef',
142 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
144 return Civi
::$statics[__CLASS__
]['fields'];
148 * Return a mapping from field-name to the corresponding key (as used in fields()).
151 * Array(string $name => string $uniqueName).
153 public static function &fieldKeys() {
154 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
155 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
157 return Civi
::$statics[__CLASS__
]['fieldKeys'];
161 * Returns the names of this table
165 public static function getTableName() {
166 return self
::$_tableName;
170 * Returns if this table needs to be logged
174 public function getLog() {
179 * Returns the list of fields that can be imported
181 * @param bool $prefix
185 public static function &import($prefix = FALSE) {
186 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'case_contact', $prefix, []);
191 * Returns the list of fields that can be exported
193 * @param bool $prefix
197 public static function &export($prefix = FALSE) {
198 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'case_contact', $prefix, []);
203 * Returns the list of indices
205 * @param bool $localize
209 public static function indices($localize = TRUE) {
211 'UI_case_contact_id' => [
212 'name' => 'UI_case_contact_id',
217 'localizable' => FALSE,
219 'sig' => 'civicrm_case_contact::1::case_id::contact_id',
222 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;