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