Merge pull request #23707 from eileenmcnaughton/import_activity
[civicrm-core.git] / CRM / Case / DAO / CaseContact.php
... / ...
CommitLineData
1<?php
2
3/**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Case/CaseContact.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:92ba2cdb76569cdd69d488e73c495374)
10 */
11
12/**
13 * Database access object for the CaseContact entity.
14 */
15class CRM_Case_DAO_CaseContact extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '2.1';
18 const COMPONENT = 'CiviCase';
19
20 /**
21 * Static instance to hold the table name.
22 *
23 * @var string
24 */
25 public static $_tableName = 'civicrm_case_contact';
26
27 /**
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 *
30 * @var bool
31 */
32 public static $_log = TRUE;
33
34 /**
35 * Unique case-contact association id
36 *
37 * @var int|string|null
38 * (SQL type: int unsigned)
39 * Note that values will be retrieved from the database as a string.
40 */
41 public $id;
42
43 /**
44 * Case ID of case-contact association.
45 *
46 * @var int|string
47 * (SQL type: int unsigned)
48 * Note that values will be retrieved from the database as a string.
49 */
50 public $case_id;
51
52 /**
53 * Contact ID of contact record given case belongs to.
54 *
55 * @var int|string
56 * (SQL type: int unsigned)
57 * Note that values will be retrieved from the database as a string.
58 */
59 public $contact_id;
60
61 /**
62 * Class constructor.
63 */
64 public function __construct() {
65 $this->__table = 'civicrm_case_contact';
66 parent::__construct();
67 }
68
69 /**
70 * Returns localized title of this entity.
71 *
72 * @param bool $plural
73 * Whether to return the plural version of the title.
74 */
75 public static function getEntityTitle($plural = FALSE) {
76 return $plural ? ts('Case Contacts') : ts('Case Contact');
77 }
78
79 /**
80 * Returns foreign keys and entity references.
81 *
82 * @return array
83 * [CRM_Core_Reference_Interface]
84 */
85 public static function getReferenceColumns() {
86 if (!isset(Civi::$statics[__CLASS__]['links'])) {
87 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
88 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'case_id', 'civicrm_case', 'id');
89 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
90 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
91 }
92 return Civi::$statics[__CLASS__]['links'];
93 }
94
95 /**
96 * Returns all the column names of this table
97 *
98 * @return array
99 */
100 public static function &fields() {
101 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
102 Civi::$statics[__CLASS__]['fields'] = [
103 'id' => [
104 'name' => 'id',
105 'type' => CRM_Utils_Type::T_INT,
106 'title' => ts('Case Contact ID'),
107 'description' => ts('Unique case-contact association id'),
108 'required' => TRUE,
109 'where' => 'civicrm_case_contact.id',
110 'table_name' => 'civicrm_case_contact',
111 'entity' => 'CaseContact',
112 'bao' => 'CRM_Case_BAO_CaseContact',
113 'localizable' => 0,
114 'html' => [
115 'type' => 'Number',
116 ],
117 'readonly' => TRUE,
118 'add' => '2.1',
119 ],
120 'case_id' => [
121 'name' => 'case_id',
122 'type' => CRM_Utils_Type::T_INT,
123 'title' => ts('Case ID'),
124 'description' => ts('Case ID of case-contact association.'),
125 'required' => TRUE,
126 'where' => 'civicrm_case_contact.case_id',
127 'table_name' => 'civicrm_case_contact',
128 'entity' => 'CaseContact',
129 'bao' => 'CRM_Case_BAO_CaseContact',
130 'localizable' => 0,
131 'FKClassName' => 'CRM_Case_DAO_Case',
132 'html' => [
133 'label' => ts("Case"),
134 ],
135 'add' => '2.1',
136 ],
137 'contact_id' => [
138 'name' => 'contact_id',
139 'type' => CRM_Utils_Type::T_INT,
140 'title' => ts('Contact ID'),
141 'description' => ts('Contact ID of contact record given case belongs to.'),
142 'required' => TRUE,
143 'where' => 'civicrm_case_contact.contact_id',
144 'table_name' => 'civicrm_case_contact',
145 'entity' => 'CaseContact',
146 'bao' => 'CRM_Case_BAO_CaseContact',
147 'localizable' => 0,
148 'FKClassName' => 'CRM_Contact_DAO_Contact',
149 'html' => [
150 'type' => 'EntityRef',
151 'label' => ts("Contact"),
152 ],
153 'add' => '2.1',
154 ],
155 ];
156 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
157 }
158 return Civi::$statics[__CLASS__]['fields'];
159 }
160
161 /**
162 * Return a mapping from field-name to the corresponding key (as used in fields()).
163 *
164 * @return array
165 * Array(string $name => string $uniqueName).
166 */
167 public static function &fieldKeys() {
168 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
169 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
170 }
171 return Civi::$statics[__CLASS__]['fieldKeys'];
172 }
173
174 /**
175 * Returns the names of this table
176 *
177 * @return string
178 */
179 public static function getTableName() {
180 return self::$_tableName;
181 }
182
183 /**
184 * Returns if this table needs to be logged
185 *
186 * @return bool
187 */
188 public function getLog() {
189 return self::$_log;
190 }
191
192 /**
193 * Returns the list of fields that can be imported
194 *
195 * @param bool $prefix
196 *
197 * @return array
198 */
199 public static function &import($prefix = FALSE) {
200 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case_contact', $prefix, []);
201 return $r;
202 }
203
204 /**
205 * Returns the list of fields that can be exported
206 *
207 * @param bool $prefix
208 *
209 * @return array
210 */
211 public static function &export($prefix = FALSE) {
212 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case_contact', $prefix, []);
213 return $r;
214 }
215
216 /**
217 * Returns the list of indices
218 *
219 * @param bool $localize
220 *
221 * @return array
222 */
223 public static function indices($localize = TRUE) {
224 $indices = [
225 'UI_case_contact_id' => [
226 'name' => 'UI_case_contact_id',
227 'field' => [
228 0 => 'case_id',
229 1 => 'contact_id',
230 ],
231 'localizable' => FALSE,
232 'unique' => TRUE,
233 'sig' => 'civicrm_case_contact::1::case_id::contact_id',
234 ],
235 ];
236 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
237 }
238
239}