Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
6b83d5bd | 5 | * @copyright CiviCRM LLC (c) 2004-2019 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Case/CaseContact.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e6ca0a57 | 9 | * (GenCodeChecksum:84dae97091e4a1612c67274f5cb10531) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the CaseContact entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Case_DAO_CaseContact extends CRM_Core_DAO { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
fa45b5b9 | 22 | public static $_tableName = 'civicrm_case_contact'; |
c3fc2621 | 23 | |
e501603b | 24 | /** |
f41f0342 | 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 26 | * |
c3fc2621 | 27 | * @var bool |
e501603b | 28 | */ |
fa45b5b9 | 29 | public static $_log = TRUE; |
c3fc2621 | 30 | |
e501603b TO |
31 | /** |
32 | * Unique case-contact association id | |
33 | * | |
e6ca0a57 | 34 | * @var int |
e501603b TO |
35 | */ |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * Case ID of case-contact association. | |
40 | * | |
e6ca0a57 | 41 | * @var int |
e501603b TO |
42 | */ |
43 | public $case_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * Contact ID of contact record given case belongs to. | |
47 | * | |
e6ca0a57 | 48 | * @var int |
e501603b TO |
49 | */ |
50 | public $contact_id; | |
c3fc2621 | 51 | |
e501603b | 52 | /** |
f41f0342 | 53 | * Class constructor. |
e501603b | 54 | */ |
c3fc2621 | 55 | public function __construct() { |
e501603b TO |
56 | $this->__table = 'civicrm_case_contact'; |
57 | parent::__construct(); | |
58 | } | |
c3fc2621 | 59 | |
e501603b | 60 | /** |
f41f0342 | 61 | * Returns foreign keys and entity references. |
e501603b TO |
62 | * |
63 | * @return array | |
64 | * [CRM_Core_Reference_Interface] | |
65 | */ | |
c3fc2621 | 66 | public static function getReferenceColumns() { |
346aaaba | 67 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 68 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
69 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'case_id', 'civicrm_case', 'id'); |
70 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); | |
346aaaba | 71 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 72 | } |
346aaaba | 73 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 74 | } |
c3fc2621 | 75 | |
e501603b TO |
76 | /** |
77 | * Returns all the column names of this table | |
78 | * | |
79 | * @return array | |
80 | */ | |
c3fc2621 | 81 | public static function &fields() { |
346aaaba | 82 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
83 | Civi::$statics[__CLASS__]['fields'] = [ |
84 | 'id' => [ | |
e501603b TO |
85 | 'name' => 'id', |
86 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 87 | 'title' => ts('Case Contact ID'), |
215b423e | 88 | 'description' => ts('Unique case-contact association id'), |
c3fc2621 | 89 | 'required' => TRUE, |
a36434b9 | 90 | 'where' => 'civicrm_case_contact.id', |
522a26c9 | 91 | 'table_name' => 'civicrm_case_contact', |
92 | 'entity' => 'CaseContact', | |
93 | 'bao' => 'CRM_Case_BAO_CaseContact', | |
6a7e5e5d | 94 | 'localizable' => 0, |
c3fc2621 CW |
95 | ], |
96 | 'case_id' => [ | |
e501603b TO |
97 | 'name' => 'case_id', |
98 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 99 | 'title' => ts('Case'), |
215b423e | 100 | 'description' => ts('Case ID of case-contact association.'), |
c3fc2621 | 101 | 'required' => TRUE, |
a36434b9 | 102 | 'where' => 'civicrm_case_contact.case_id', |
522a26c9 | 103 | 'table_name' => 'civicrm_case_contact', |
104 | 'entity' => 'CaseContact', | |
105 | 'bao' => 'CRM_Case_BAO_CaseContact', | |
6a7e5e5d | 106 | 'localizable' => 0, |
e501603b | 107 | 'FKClassName' => 'CRM_Case_DAO_Case', |
c3fc2621 CW |
108 | ], |
109 | 'contact_id' => [ | |
e501603b TO |
110 | 'name' => 'contact_id', |
111 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 112 | 'title' => ts('Contact ID'), |
215b423e | 113 | 'description' => ts('Contact ID of contact record given case belongs to.'), |
c3fc2621 | 114 | 'required' => TRUE, |
a36434b9 | 115 | 'where' => 'civicrm_case_contact.contact_id', |
522a26c9 | 116 | 'table_name' => 'civicrm_case_contact', |
117 | 'entity' => 'CaseContact', | |
118 | 'bao' => 'CRM_Case_BAO_CaseContact', | |
6a7e5e5d | 119 | 'localizable' => 0, |
e501603b | 120 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 | 121 | 'html' => [ |
e501603b | 122 | 'type' => 'EntityRef', |
c3fc2621 CW |
123 | ], |
124 | ], | |
125 | ]; | |
346aaaba | 126 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 127 | } |
346aaaba | 128 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 129 | } |
c3fc2621 | 130 | |
e501603b | 131 | /** |
bd8e0b14 | 132 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
133 | * |
134 | * @return array | |
bd8e0b14 | 135 | * Array(string $name => string $uniqueName). |
e501603b | 136 | */ |
c3fc2621 | 137 | public static function &fieldKeys() { |
bd8e0b14 TO |
138 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
139 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 140 | } |
bd8e0b14 | 141 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 142 | } |
c3fc2621 | 143 | |
e501603b TO |
144 | /** |
145 | * Returns the names of this table | |
146 | * | |
147 | * @return string | |
148 | */ | |
c3fc2621 | 149 | public static function getTableName() { |
e501603b TO |
150 | return self::$_tableName; |
151 | } | |
c3fc2621 | 152 | |
e501603b TO |
153 | /** |
154 | * Returns if this table needs to be logged | |
155 | * | |
c3fc2621 | 156 | * @return bool |
e501603b | 157 | */ |
c3fc2621 | 158 | public function getLog() { |
e501603b TO |
159 | return self::$_log; |
160 | } | |
c3fc2621 | 161 | |
e501603b TO |
162 | /** |
163 | * Returns the list of fields that can be imported | |
164 | * | |
165 | * @param bool $prefix | |
166 | * | |
167 | * @return array | |
168 | */ | |
c3fc2621 CW |
169 | public static function &import($prefix = FALSE) { |
170 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case_contact', $prefix, []); | |
60808919 | 171 | return $r; |
e501603b | 172 | } |
c3fc2621 | 173 | |
e501603b TO |
174 | /** |
175 | * Returns the list of fields that can be exported | |
176 | * | |
177 | * @param bool $prefix | |
178 | * | |
179 | * @return array | |
180 | */ | |
c3fc2621 CW |
181 | public static function &export($prefix = FALSE) { |
182 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case_contact', $prefix, []); | |
60808919 | 183 | return $r; |
e501603b | 184 | } |
c3fc2621 | 185 | |
e7a6b91a AS |
186 | /** |
187 | * Returns the list of indices | |
c3fc2621 CW |
188 | * |
189 | * @param bool $localize | |
190 | * | |
191 | * @return array | |
e7a6b91a AS |
192 | */ |
193 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
194 | $indices = [ |
195 | 'UI_case_contact_id' => [ | |
e7a6b91a | 196 | 'name' => 'UI_case_contact_id', |
c3fc2621 | 197 | 'field' => [ |
e7a6b91a AS |
198 | 0 => 'case_id', |
199 | 1 => 'contact_id', | |
c3fc2621 CW |
200 | ], |
201 | 'localizable' => FALSE, | |
202 | 'unique' => TRUE, | |
738b63ef | 203 | 'sig' => 'civicrm_case_contact::1::case_id::contact_id', |
c3fc2621 CW |
204 | ], |
205 | ]; | |
e7a6b91a AS |
206 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
207 | } | |
c3fc2621 | 208 | |
e501603b | 209 | } |