Cleanup references to old dedupe class names
[civicrm-core.git] / CRM / Contact / DAO / RelationshipCache.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Contact/RelationshipCache.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:3376402e2a249b7004b40df6aeac5df9)
10 */
11
12 /**
13 * Database access object for the RelationshipCache entity.
14 */
15 class CRM_Contact_DAO_RelationshipCache extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '5.29';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_relationship_cache';
25
26 /**
27 * Icon associated with this entity.
28 *
29 * @var string
30 */
31 public static $_icon = 'fa-handshake-o';
32
33 /**
34 * Should CiviCRM log any modifications to this table in the civicrm_log table.
35 *
36 * @var bool
37 */
38 public static $_log = FALSE;
39
40 /**
41 * Relationship Cache ID
42 *
43 * @var int
44 */
45 public $id;
46
47 /**
48 * id of the relationship (FK to civicrm_relationship.id)
49 *
50 * @var int
51 */
52 public $relationship_id;
53
54 /**
55 * id of the relationship type
56 *
57 * @var int
58 */
59 public $relationship_type_id;
60
61 /**
62 * The cache record is a permutation of the original relationship record. The orientation indicates whether it is forward (a_b) or reverse (b_a) relationship.
63 *
64 * @var string
65 */
66 public $orientation;
67
68 /**
69 * id of the first contact
70 *
71 * @var int
72 */
73 public $near_contact_id;
74
75 /**
76 * name for relationship of near_contact to far_contact.
77 *
78 * @var string
79 */
80 public $near_relation;
81
82 /**
83 * id of the second contact
84 *
85 * @var int
86 */
87 public $far_contact_id;
88
89 /**
90 * name for relationship of far_contact to near_contact.
91 *
92 * @var string
93 */
94 public $far_relation;
95
96 /**
97 * is the relationship active ?
98 *
99 * @var bool
100 */
101 public $is_active;
102
103 /**
104 * date when the relationship started
105 *
106 * @var date
107 */
108 public $start_date;
109
110 /**
111 * date when the relationship ended
112 *
113 * @var date
114 */
115 public $end_date;
116
117 /**
118 * Class constructor.
119 */
120 public function __construct() {
121 $this->__table = 'civicrm_relationship_cache';
122 parent::__construct();
123 }
124
125 /**
126 * Returns localized title of this entity.
127 *
128 * @param bool $plural
129 * Whether to return the plural version of the title.
130 */
131 public static function getEntityTitle($plural = FALSE) {
132 return $plural ? ts('Related Contacts') : ts('Related Contact');
133 }
134
135 /**
136 * Returns foreign keys and entity references.
137 *
138 * @return array
139 * [CRM_Core_Reference_Interface]
140 */
141 public static function getReferenceColumns() {
142 if (!isset(Civi::$statics[__CLASS__]['links'])) {
143 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
144 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'relationship_id', 'civicrm_relationship', 'id');
145 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'relationship_type_id', 'civicrm_relationship_type', 'id');
146 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'near_contact_id', 'civicrm_contact', 'id');
147 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'far_contact_id', 'civicrm_contact', 'id');
148 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
149 }
150 return Civi::$statics[__CLASS__]['links'];
151 }
152
153 /**
154 * Returns all the column names of this table
155 *
156 * @return array
157 */
158 public static function &fields() {
159 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
160 Civi::$statics[__CLASS__]['fields'] = [
161 'id' => [
162 'name' => 'id',
163 'type' => CRM_Utils_Type::T_INT,
164 'title' => ts('Relationship Cache ID'),
165 'description' => ts('Relationship Cache ID'),
166 'required' => TRUE,
167 'where' => 'civicrm_relationship_cache.id',
168 'table_name' => 'civicrm_relationship_cache',
169 'entity' => 'RelationshipCache',
170 'bao' => 'CRM_Contact_BAO_RelationshipCache',
171 'localizable' => 0,
172 'html' => [
173 'type' => 'Number',
174 ],
175 'readonly' => TRUE,
176 'add' => '5.29',
177 ],
178 'relationship_id' => [
179 'name' => 'relationship_id',
180 'type' => CRM_Utils_Type::T_INT,
181 'title' => ts('Relationship ID'),
182 'description' => ts('id of the relationship (FK to civicrm_relationship.id)'),
183 'required' => TRUE,
184 'where' => 'civicrm_relationship_cache.relationship_id',
185 'table_name' => 'civicrm_relationship_cache',
186 'entity' => 'RelationshipCache',
187 'bao' => 'CRM_Contact_BAO_RelationshipCache',
188 'localizable' => 0,
189 'FKClassName' => 'CRM_Contact_DAO_Relationship',
190 'html' => [
191 'label' => ts("Relationship"),
192 ],
193 'readonly' => TRUE,
194 'add' => '5.29',
195 ],
196 'relationship_type_id' => [
197 'name' => 'relationship_type_id',
198 'type' => CRM_Utils_Type::T_INT,
199 'title' => ts('Relationship Type ID'),
200 'description' => ts('id of the relationship type'),
201 'required' => TRUE,
202 'where' => 'civicrm_relationship_cache.relationship_type_id',
203 'table_name' => 'civicrm_relationship_cache',
204 'entity' => 'RelationshipCache',
205 'bao' => 'CRM_Contact_BAO_RelationshipCache',
206 'localizable' => 0,
207 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
208 'html' => [
209 'label' => ts("Relationship Type"),
210 ],
211 'readonly' => TRUE,
212 'add' => '5.29',
213 ],
214 'orientation' => [
215 'name' => 'orientation',
216 'type' => CRM_Utils_Type::T_STRING,
217 'title' => ts('Orientation (a_b or b_a)'),
218 'description' => ts('The cache record is a permutation of the original relationship record. The orientation indicates whether it is forward (a_b) or reverse (b_a) relationship.'),
219 'required' => TRUE,
220 'maxlength' => 3,
221 'size' => CRM_Utils_Type::FOUR,
222 'where' => 'civicrm_relationship_cache.orientation',
223 'table_name' => 'civicrm_relationship_cache',
224 'entity' => 'RelationshipCache',
225 'bao' => 'CRM_Contact_BAO_RelationshipCache',
226 'localizable' => 0,
227 'pseudoconstant' => [
228 'callback' => 'CRM_Core_SelectValues::relationshipOrientation',
229 ],
230 'readonly' => TRUE,
231 'add' => '5.29',
232 ],
233 'near_contact_id' => [
234 'name' => 'near_contact_id',
235 'type' => CRM_Utils_Type::T_INT,
236 'title' => ts('Contact ID (Near side)'),
237 'description' => ts('id of the first contact'),
238 'required' => TRUE,
239 'where' => 'civicrm_relationship_cache.near_contact_id',
240 'table_name' => 'civicrm_relationship_cache',
241 'entity' => 'RelationshipCache',
242 'bao' => 'CRM_Contact_BAO_RelationshipCache',
243 'localizable' => 0,
244 'FKClassName' => 'CRM_Contact_DAO_Contact',
245 'html' => [
246 'type' => 'EntityRef',
247 'label' => ts("Contact (Near side)"),
248 ],
249 'readonly' => TRUE,
250 'add' => '5.29',
251 ],
252 'near_relation' => [
253 'name' => 'near_relation',
254 'type' => CRM_Utils_Type::T_STRING,
255 'title' => ts('Relationship Name (to related contact)'),
256 'description' => ts('name for relationship of near_contact to far_contact.'),
257 'maxlength' => 64,
258 'size' => CRM_Utils_Type::BIG,
259 'where' => 'civicrm_relationship_cache.near_relation',
260 'table_name' => 'civicrm_relationship_cache',
261 'entity' => 'RelationshipCache',
262 'bao' => 'CRM_Contact_BAO_RelationshipCache',
263 'localizable' => 0,
264 'html' => [
265 'label' => ts("Relationship to contact"),
266 ],
267 'pseudoconstant' => [
268 'callback' => 'CRM_Core_PseudoConstant::relationshipTypeOptions',
269 ],
270 'readonly' => TRUE,
271 'add' => '5.29',
272 ],
273 'far_contact_id' => [
274 'name' => 'far_contact_id',
275 'type' => CRM_Utils_Type::T_INT,
276 'title' => ts('Contact ID (Far side)'),
277 'description' => ts('id of the second contact'),
278 'required' => TRUE,
279 'where' => 'civicrm_relationship_cache.far_contact_id',
280 'table_name' => 'civicrm_relationship_cache',
281 'entity' => 'RelationshipCache',
282 'bao' => 'CRM_Contact_BAO_RelationshipCache',
283 'localizable' => 0,
284 'FKClassName' => 'CRM_Contact_DAO_Contact',
285 'html' => [
286 'type' => 'EntityRef',
287 'label' => ts("Contact (Far side)"),
288 ],
289 'readonly' => TRUE,
290 'add' => '5.29',
291 ],
292 'far_relation' => [
293 'name' => 'far_relation',
294 'type' => CRM_Utils_Type::T_STRING,
295 'title' => ts('Relationship Name (from related contact)'),
296 'description' => ts('name for relationship of far_contact to near_contact.'),
297 'maxlength' => 64,
298 'size' => CRM_Utils_Type::BIG,
299 'where' => 'civicrm_relationship_cache.far_relation',
300 'table_name' => 'civicrm_relationship_cache',
301 'entity' => 'RelationshipCache',
302 'bao' => 'CRM_Contact_BAO_RelationshipCache',
303 'localizable' => 0,
304 'html' => [
305 'label' => ts("Relationship from contact"),
306 ],
307 'pseudoconstant' => [
308 'callback' => 'CRM_Core_PseudoConstant::relationshipTypeOptions',
309 ],
310 'readonly' => TRUE,
311 'add' => '5.29',
312 ],
313 'is_active' => [
314 'name' => 'is_active',
315 'type' => CRM_Utils_Type::T_BOOLEAN,
316 'title' => ts('Relationship Is Active'),
317 'description' => ts('is the relationship active ?'),
318 'where' => 'civicrm_relationship_cache.is_active',
319 'default' => '1',
320 'table_name' => 'civicrm_relationship_cache',
321 'entity' => 'RelationshipCache',
322 'bao' => 'CRM_Contact_BAO_RelationshipCache',
323 'localizable' => 0,
324 'html' => [
325 'type' => 'CheckBox',
326 ],
327 'readonly' => TRUE,
328 'add' => '5.29',
329 ],
330 'relationship_start_date' => [
331 'name' => 'start_date',
332 'type' => CRM_Utils_Type::T_DATE,
333 'title' => ts('Relationship Start Date'),
334 'description' => ts('date when the relationship started'),
335 'where' => 'civicrm_relationship_cache.start_date',
336 'table_name' => 'civicrm_relationship_cache',
337 'entity' => 'RelationshipCache',
338 'bao' => 'CRM_Contact_BAO_RelationshipCache',
339 'localizable' => 0,
340 'html' => [
341 'type' => 'Select Date',
342 'formatType' => 'activityDate',
343 ],
344 'readonly' => TRUE,
345 'add' => '5.29',
346 ],
347 'relationship_end_date' => [
348 'name' => 'end_date',
349 'type' => CRM_Utils_Type::T_DATE,
350 'title' => ts('Relationship End Date'),
351 'description' => ts('date when the relationship ended'),
352 'where' => 'civicrm_relationship_cache.end_date',
353 'table_name' => 'civicrm_relationship_cache',
354 'entity' => 'RelationshipCache',
355 'bao' => 'CRM_Contact_BAO_RelationshipCache',
356 'localizable' => 0,
357 'html' => [
358 'type' => 'Select Date',
359 'formatType' => 'activityDate',
360 ],
361 'readonly' => TRUE,
362 'add' => '5.29',
363 ],
364 ];
365 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
366 }
367 return Civi::$statics[__CLASS__]['fields'];
368 }
369
370 /**
371 * Return a mapping from field-name to the corresponding key (as used in fields()).
372 *
373 * @return array
374 * Array(string $name => string $uniqueName).
375 */
376 public static function &fieldKeys() {
377 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
378 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
379 }
380 return Civi::$statics[__CLASS__]['fieldKeys'];
381 }
382
383 /**
384 * Returns the names of this table
385 *
386 * @return string
387 */
388 public static function getTableName() {
389 return self::$_tableName;
390 }
391
392 /**
393 * Returns if this table needs to be logged
394 *
395 * @return bool
396 */
397 public function getLog() {
398 return self::$_log;
399 }
400
401 /**
402 * Returns the list of fields that can be imported
403 *
404 * @param bool $prefix
405 *
406 * @return array
407 */
408 public static function &import($prefix = FALSE) {
409 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'relationship_cache', $prefix, []);
410 return $r;
411 }
412
413 /**
414 * Returns the list of fields that can be exported
415 *
416 * @param bool $prefix
417 *
418 * @return array
419 */
420 public static function &export($prefix = FALSE) {
421 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'relationship_cache', $prefix, []);
422 return $r;
423 }
424
425 /**
426 * Returns the list of indices
427 *
428 * @param bool $localize
429 *
430 * @return array
431 */
432 public static function indices($localize = TRUE) {
433 $indices = [
434 'UI_relationship' => [
435 'name' => 'UI_relationship',
436 'field' => [
437 0 => 'relationship_id',
438 1 => 'orientation',
439 ],
440 'localizable' => FALSE,
441 'unique' => TRUE,
442 'sig' => 'civicrm_relationship_cache::1::relationship_id::orientation',
443 ],
444 'index_nearid_nearrelation' => [
445 'name' => 'index_nearid_nearrelation',
446 'field' => [
447 0 => 'near_contact_id',
448 1 => 'near_relation',
449 ],
450 'localizable' => FALSE,
451 'sig' => 'civicrm_relationship_cache::0::near_contact_id::near_relation',
452 ],
453 'index_nearid_farrelation' => [
454 'name' => 'index_nearid_farrelation',
455 'field' => [
456 0 => 'near_contact_id',
457 1 => 'far_relation',
458 ],
459 'localizable' => FALSE,
460 'sig' => 'civicrm_relationship_cache::0::near_contact_id::far_relation',
461 ],
462 'index_near_relation' => [
463 'name' => 'index_near_relation',
464 'field' => [
465 0 => 'near_relation',
466 ],
467 'localizable' => FALSE,
468 'sig' => 'civicrm_relationship_cache::0::near_relation',
469 ],
470 ];
471 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
472 }
473
474 }