Don't crash with missing class if action is not defined when opening new case
[civicrm-core.git] / CRM / Contact / DAO / RelationshipType.php
CommitLineData
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/Contact/RelationshipType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e380ee3b 9 * (GenCodeChecksum:9fa07d6d85caa27a637694324ea5b740)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the RelationshipType entity.
f41f0342 14 */
e501603b 15class CRM_Contact_DAO_RelationshipType extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
22 static $_tableName = 'civicrm_relationship_type';
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 */
c3fc2621
CW
29 static $_log = TRUE;
30
e501603b
TO
31 /**
32 * Primary key
33 *
34 * @var int unsigned
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * name for relationship of contact_a to contact_b.
40 *
41 * @var string
42 */
43 public $name_a_b;
c3fc2621 44
e501603b
TO
45 /**
46 * label for relationship of contact_a to contact_b.
47 *
48 * @var string
49 */
50 public $label_a_b;
c3fc2621 51
e501603b
TO
52 /**
53 * Optional name for relationship of contact_b to contact_a.
54 *
55 * @var string
56 */
57 public $name_b_a;
c3fc2621 58
e501603b
TO
59 /**
60 * Optional label for relationship of contact_b to contact_a.
61 *
62 * @var string
63 */
64 public $label_b_a;
c3fc2621 65
e501603b
TO
66 /**
67 * Optional verbose description of the relationship type.
68 *
69 * @var string
70 */
71 public $description;
c3fc2621 72
e501603b
TO
73 /**
74 * If defined, contact_a in a relationship of this type must be a specific contact_type.
75 *
76 * @var string
77 */
78 public $contact_type_a;
c3fc2621 79
e501603b
TO
80 /**
81 * If defined, contact_b in a relationship of this type must be a specific contact_type.
82 *
83 * @var string
84 */
85 public $contact_type_b;
c3fc2621 86
e501603b
TO
87 /**
88 * If defined, contact_sub_type_a in a relationship of this type must be a specific contact_sub_type.
89 *
90 * @var string
91 */
92 public $contact_sub_type_a;
c3fc2621 93
e501603b
TO
94 /**
95 * If defined, contact_sub_type_b in a relationship of this type must be a specific contact_sub_type.
96 *
97 * @var string
98 */
99 public $contact_sub_type_b;
c3fc2621 100
e501603b
TO
101 /**
102 * Is this relationship type a predefined system type (can not be changed or de-activated)?
103 *
104 * @var boolean
105 */
106 public $is_reserved;
c3fc2621 107
e501603b
TO
108 /**
109 * Is this relationship type currently active (i.e. can be used when creating or editing relationships)?
110 *
111 * @var boolean
112 */
113 public $is_active;
c3fc2621 114
e501603b 115 /**
f41f0342 116 * Class constructor.
e501603b 117 */
c3fc2621 118 public function __construct() {
e501603b
TO
119 $this->__table = 'civicrm_relationship_type';
120 parent::__construct();
121 }
c3fc2621 122
e501603b
TO
123 /**
124 * Returns all the column names of this table
125 *
126 * @return array
127 */
c3fc2621 128 public static function &fields() {
346aaaba 129 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
130 Civi::$statics[__CLASS__]['fields'] = [
131 'id' => [
e501603b
TO
132 'name' => 'id',
133 'type' => CRM_Utils_Type::T_INT,
c3fc2621 134 'title' => ts('Relationship Type ID'),
215b423e 135 'description' => ts('Primary key'),
c3fc2621 136 'required' => TRUE,
522a26c9 137 'table_name' => 'civicrm_relationship_type',
138 'entity' => 'RelationshipType',
139 'bao' => 'CRM_Contact_BAO_RelationshipType',
6a7e5e5d 140 'localizable' => 0,
c3fc2621
CW
141 ],
142 'name_a_b' => [
e501603b
TO
143 'name' => 'name_a_b',
144 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 145 'title' => ts('Relationship Type Name A to B'),
215b423e 146 'description' => ts('name for relationship of contact_a to contact_b.'),
e501603b
TO
147 'maxlength' => 64,
148 'size' => CRM_Utils_Type::BIG,
522a26c9 149 'table_name' => 'civicrm_relationship_type',
150 'entity' => 'RelationshipType',
151 'bao' => 'CRM_Contact_BAO_RelationshipType',
6a7e5e5d 152 'localizable' => 0,
c3fc2621
CW
153 ],
154 'label_a_b' => [
e501603b
TO
155 'name' => 'label_a_b',
156 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 157 'title' => ts('Relationship Type Label A to B'),
215b423e 158 'description' => ts('label for relationship of contact_a to contact_b.'),
e501603b
TO
159 'maxlength' => 64,
160 'size' => CRM_Utils_Type::BIG,
522a26c9 161 'table_name' => 'civicrm_relationship_type',
162 'entity' => 'RelationshipType',
163 'bao' => 'CRM_Contact_BAO_RelationshipType',
6a7e5e5d 164 'localizable' => 1,
a9999eb6 165 'html' => [
166 'type' => 'Text',
167 ],
c3fc2621
CW
168 ],
169 'name_b_a' => [
e501603b
TO
170 'name' => 'name_b_a',
171 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 172 'title' => ts('Relationship Type Name B to A'),
215b423e 173 'description' => ts('Optional name for relationship of contact_b to contact_a.'),
e501603b
TO
174 'maxlength' => 64,
175 'size' => CRM_Utils_Type::BIG,
522a26c9 176 'table_name' => 'civicrm_relationship_type',
177 'entity' => 'RelationshipType',
178 'bao' => 'CRM_Contact_BAO_RelationshipType',
6a7e5e5d 179 'localizable' => 0,
c3fc2621
CW
180 ],
181 'label_b_a' => [
e501603b
TO
182 'name' => 'label_b_a',
183 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 184 'title' => ts('Relationship Type Label B to A'),
215b423e 185 'description' => ts('Optional label for relationship of contact_b to contact_a.'),
e501603b
TO
186 'maxlength' => 64,
187 'size' => CRM_Utils_Type::BIG,
522a26c9 188 'table_name' => 'civicrm_relationship_type',
189 'entity' => 'RelationshipType',
190 'bao' => 'CRM_Contact_BAO_RelationshipType',
6a7e5e5d 191 'localizable' => 1,
a9999eb6 192 'html' => [
193 'type' => 'Text',
194 ],
c3fc2621
CW
195 ],
196 'description' => [
e501603b
TO
197 'name' => 'description',
198 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 199 'title' => ts('Relationship Description'),
215b423e 200 'description' => ts('Optional verbose description of the relationship type.'),
e501603b
TO
201 'maxlength' => 255,
202 'size' => CRM_Utils_Type::HUGE,
522a26c9 203 'table_name' => 'civicrm_relationship_type',
204 'entity' => 'RelationshipType',
205 'bao' => 'CRM_Contact_BAO_RelationshipType',
6a7e5e5d 206 'localizable' => 1,
a9999eb6 207 'html' => [
208 'type' => 'Text',
209 ],
c3fc2621
CW
210 ],
211 'contact_type_a' => [
e501603b
TO
212 'name' => 'contact_type_a',
213 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 214 'title' => ts('Contact Type for Contact A'),
215b423e 215 'description' => ts('If defined, contact_a in a relationship of this type must be a specific contact_type.'),
e501603b
TO
216 'maxlength' => 12,
217 'size' => CRM_Utils_Type::TWELVE,
522a26c9 218 'table_name' => 'civicrm_relationship_type',
219 'entity' => 'RelationshipType',
220 'bao' => 'CRM_Contact_BAO_RelationshipType',
6a7e5e5d 221 'localizable' => 0,
c3fc2621 222 'html' => [
e501603b 223 'type' => 'Select',
c3fc2621
CW
224 ],
225 'pseudoconstant' => [
e501603b
TO
226 'table' => 'civicrm_contact_type',
227 'keyColumn' => 'name',
228 'labelColumn' => 'label',
229 'condition' => 'parent_id IS NULL',
c3fc2621
CW
230 ]
231 ],
232 'contact_type_b' => [
e501603b
TO
233 'name' => 'contact_type_b',
234 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 235 'title' => ts('Contact Type for Contact B'),
215b423e 236 'description' => ts('If defined, contact_b in a relationship of this type must be a specific contact_type.'),
e501603b
TO
237 'maxlength' => 12,
238 'size' => CRM_Utils_Type::TWELVE,
522a26c9 239 'table_name' => 'civicrm_relationship_type',
240 'entity' => 'RelationshipType',
241 'bao' => 'CRM_Contact_BAO_RelationshipType',
6a7e5e5d 242 'localizable' => 0,
c3fc2621 243 'html' => [
e501603b 244 'type' => 'Select',
c3fc2621
CW
245 ],
246 'pseudoconstant' => [
e501603b
TO
247 'table' => 'civicrm_contact_type',
248 'keyColumn' => 'name',
249 'labelColumn' => 'label',
250 'condition' => 'parent_id IS NULL',
c3fc2621
CW
251 ]
252 ],
253 'contact_sub_type_a' => [
e501603b
TO
254 'name' => 'contact_sub_type_a',
255 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 256 'title' => ts('Contact Subtype A'),
215b423e 257 'description' => ts('If defined, contact_sub_type_a in a relationship of this type must be a specific contact_sub_type.
258 '),
e501603b
TO
259 'maxlength' => 64,
260 'size' => CRM_Utils_Type::BIG,
522a26c9 261 'table_name' => 'civicrm_relationship_type',
262 'entity' => 'RelationshipType',
263 'bao' => 'CRM_Contact_BAO_RelationshipType',
6a7e5e5d 264 'localizable' => 0,
c3fc2621 265 'html' => [
e501603b 266 'type' => 'Select',
c3fc2621
CW
267 ],
268 'pseudoconstant' => [
e501603b
TO
269 'table' => 'civicrm_contact_type',
270 'keyColumn' => 'name',
271 'labelColumn' => 'label',
272 'condition' => 'parent_id IS NOT NULL',
c3fc2621
CW
273 ]
274 ],
275 'contact_sub_type_b' => [
e501603b
TO
276 'name' => 'contact_sub_type_b',
277 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 278 'title' => ts('Contact Subtype B'),
215b423e 279 'description' => ts('If defined, contact_sub_type_b in a relationship of this type must be a specific contact_sub_type.
280 '),
e501603b
TO
281 'maxlength' => 64,
282 'size' => CRM_Utils_Type::BIG,
522a26c9 283 'table_name' => 'civicrm_relationship_type',
284 'entity' => 'RelationshipType',
285 'bao' => 'CRM_Contact_BAO_RelationshipType',
6a7e5e5d 286 'localizable' => 0,
c3fc2621 287 'html' => [
e501603b 288 'type' => 'Select',
c3fc2621
CW
289 ],
290 'pseudoconstant' => [
e501603b
TO
291 'table' => 'civicrm_contact_type',
292 'keyColumn' => 'name',
293 'labelColumn' => 'label',
294 'condition' => 'parent_id IS NOT NULL',
c3fc2621
CW
295 ]
296 ],
297 'is_reserved' => [
e501603b
TO
298 'name' => 'is_reserved',
299 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 300 'title' => ts('Relationship Type is Reserved'),
215b423e 301 'description' => ts('Is this relationship type a predefined system type (can not be changed or de-activated)?'),
522a26c9 302 'table_name' => 'civicrm_relationship_type',
303 'entity' => 'RelationshipType',
304 'bao' => 'CRM_Contact_BAO_RelationshipType',
6a7e5e5d 305 'localizable' => 0,
a9999eb6 306 'html' => [
307 'type' => 'CheckBox',
308 ],
c3fc2621
CW
309 ],
310 'is_active' => [
e501603b
TO
311 'name' => 'is_active',
312 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 313 'title' => ts('Relationship Type is Active'),
215b423e 314 'description' => ts('Is this relationship type currently active (i.e. can be used when creating or editing relationships)?
315 '),
e501603b 316 'default' => '1',
522a26c9 317 'table_name' => 'civicrm_relationship_type',
318 'entity' => 'RelationshipType',
319 'bao' => 'CRM_Contact_BAO_RelationshipType',
6a7e5e5d 320 'localizable' => 0,
a9999eb6 321 'html' => [
322 'type' => 'CheckBox',
323 ],
c3fc2621
CW
324 ],
325 ];
346aaaba 326 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 327 }
346aaaba 328 return Civi::$statics[__CLASS__]['fields'];
e501603b 329 }
c3fc2621 330
e501603b 331 /**
bd8e0b14 332 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
333 *
334 * @return array
bd8e0b14 335 * Array(string $name => string $uniqueName).
e501603b 336 */
c3fc2621 337 public static function &fieldKeys() {
bd8e0b14
TO
338 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
339 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 340 }
bd8e0b14 341 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 342 }
c3fc2621 343
e501603b
TO
344 /**
345 * Returns the names of this table
346 *
347 * @return string
348 */
c3fc2621 349 public static function getTableName() {
e501603b
TO
350 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
351 }
c3fc2621 352
e501603b
TO
353 /**
354 * Returns if this table needs to be logged
355 *
c3fc2621 356 * @return bool
e501603b 357 */
c3fc2621 358 public function getLog() {
e501603b
TO
359 return self::$_log;
360 }
c3fc2621 361
e501603b
TO
362 /**
363 * Returns the list of fields that can be imported
364 *
365 * @param bool $prefix
366 *
367 * @return array
368 */
c3fc2621
CW
369 public static function &import($prefix = FALSE) {
370 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'relationship_type', $prefix, []);
60808919 371 return $r;
e501603b 372 }
c3fc2621 373
e501603b
TO
374 /**
375 * Returns the list of fields that can be exported
376 *
377 * @param bool $prefix
378 *
379 * @return array
380 */
c3fc2621
CW
381 public static function &export($prefix = FALSE) {
382 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'relationship_type', $prefix, []);
60808919 383 return $r;
e501603b 384 }
c3fc2621 385
e7a6b91a
AS
386 /**
387 * Returns the list of indices
c3fc2621
CW
388 *
389 * @param bool $localize
390 *
391 * @return array
e7a6b91a
AS
392 */
393 public static function indices($localize = TRUE) {
c3fc2621
CW
394 $indices = [
395 'UI_name_a_b' => [
e7a6b91a 396 'name' => 'UI_name_a_b',
c3fc2621 397 'field' => [
e7a6b91a 398 0 => 'name_a_b',
c3fc2621
CW
399 ],
400 'localizable' => FALSE,
401 'unique' => TRUE,
e7a6b91a 402 'sig' => 'civicrm_relationship_type::1::name_a_b',
c3fc2621
CW
403 ],
404 'UI_name_b_a' => [
e7a6b91a 405 'name' => 'UI_name_b_a',
c3fc2621 406 'field' => [
e7a6b91a 407 0 => 'name_b_a',
c3fc2621
CW
408 ],
409 'localizable' => FALSE,
410 'unique' => TRUE,
e7a6b91a 411 'sig' => 'civicrm_relationship_type::1::name_b_a',
c3fc2621
CW
412 ],
413 ];
e7a6b91a
AS
414 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
415 }
c3fc2621 416
e501603b 417}