Regenerate DAO files
[civicrm-core.git] / CRM / Contact / DAO / Group.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/Group.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e6ca0a57 9 * (GenCodeChecksum:28c32e7038a2b7aa7ca2c45117660974)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Group entity.
f41f0342 14 */
e501603b 15class CRM_Contact_DAO_Group 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_group';
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 * Group ID
33 *
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Internal name of Group.
40 *
41 * @var string
42 */
43 public $name;
c3fc2621 44
e501603b
TO
45 /**
46 * Name of Group.
47 *
48 * @var string
49 */
50 public $title;
c3fc2621 51
e501603b
TO
52 /**
53 * Optional verbose description of the group.
54 *
55 * @var text
56 */
57 public $description;
c3fc2621 58
e501603b
TO
59 /**
60 * Module or process which created this group.
61 *
62 * @var string
63 */
64 public $source;
c3fc2621 65
e501603b
TO
66 /**
67 * FK to saved search table.
68 *
e6ca0a57 69 * @var int
e501603b
TO
70 */
71 public $saved_search_id;
c3fc2621 72
e501603b
TO
73 /**
74 * Is this entry active?
75 *
e6ca0a57 76 * @var bool
e501603b
TO
77 */
78 public $is_active;
c3fc2621 79
e501603b
TO
80 /**
81 * In what context(s) is this field visible.
82 *
83 * @var string
84 */
85 public $visibility;
c3fc2621 86
e501603b
TO
87 /**
88 * the sql where clause if a saved search acl
89 *
90 * @var text
91 */
92 public $where_clause;
c3fc2621 93
e501603b
TO
94 /**
95 * the tables to be included in a select data
96 *
97 * @var text
98 */
99 public $select_tables;
c3fc2621 100
e501603b
TO
101 /**
102 * the tables to be included in the count statement
103 *
104 * @var text
105 */
106 public $where_tables;
c3fc2621 107
e501603b
TO
108 /**
109 * FK to group type
110 *
111 * @var string
112 */
113 public $group_type;
c3fc2621 114
e501603b
TO
115 /**
116 * Date when we created the cache for a smart group
117 *
118 * @var timestamp
119 */
120 public $cache_date;
c3fc2621 121
e501603b
TO
122 /**
123 * Date and time when we need to refresh the cache next.
124 *
125 * @var timestamp
126 */
127 public $refresh_date;
c3fc2621 128
e501603b
TO
129 /**
130 * IDs of the parent(s)
131 *
132 * @var text
133 */
134 public $parents;
c3fc2621 135
e501603b
TO
136 /**
137 * IDs of the child(ren)
138 *
139 * @var text
140 */
141 public $children;
c3fc2621 142
e501603b
TO
143 /**
144 * Is this group hidden?
145 *
e6ca0a57 146 * @var bool
e501603b
TO
147 */
148 public $is_hidden;
c3fc2621 149
e501603b 150 /**
e6ca0a57 151 * @var bool
e501603b
TO
152 */
153 public $is_reserved;
c3fc2621 154
e501603b
TO
155 /**
156 * FK to contact table.
157 *
e6ca0a57 158 * @var int
e501603b
TO
159 */
160 public $created_id;
c3fc2621 161
e501603b
TO
162 /**
163 * FK to contact table.
164 *
e6ca0a57 165 * @var int
e501603b
TO
166 */
167 public $modified_id;
c3fc2621 168
e501603b 169 /**
f41f0342 170 * Class constructor.
e501603b 171 */
c3fc2621 172 public function __construct() {
e501603b
TO
173 $this->__table = 'civicrm_group';
174 parent::__construct();
175 }
c3fc2621 176
e501603b 177 /**
f41f0342 178 * Returns foreign keys and entity references.
e501603b
TO
179 *
180 * @return array
181 * [CRM_Core_Reference_Interface]
182 */
c3fc2621 183 public static function getReferenceColumns() {
346aaaba 184 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 185 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
186 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'saved_search_id', 'civicrm_saved_search', 'id');
187 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
188 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'modified_id', 'civicrm_contact', 'id');
346aaaba 189 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 190 }
346aaaba 191 return Civi::$statics[__CLASS__]['links'];
e501603b 192 }
c3fc2621 193
e501603b
TO
194 /**
195 * Returns all the column names of this table
196 *
197 * @return array
198 */
c3fc2621 199 public static function &fields() {
346aaaba 200 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
201 Civi::$statics[__CLASS__]['fields'] = [
202 'id' => [
e501603b
TO
203 'name' => 'id',
204 'type' => CRM_Utils_Type::T_INT,
c3fc2621 205 'title' => ts('Group ID'),
215b423e 206 'description' => ts('Group ID'),
c3fc2621 207 'required' => TRUE,
a36434b9 208 'where' => 'civicrm_group.id',
522a26c9 209 'table_name' => 'civicrm_group',
210 'entity' => 'Group',
211 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 212 'localizable' => 0,
c3fc2621
CW
213 ],
214 'name' => [
e501603b
TO
215 'name' => 'name',
216 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 217 'title' => ts('Group Name'),
215b423e 218 'description' => ts('Internal name of Group.'),
e501603b
TO
219 'maxlength' => 64,
220 'size' => CRM_Utils_Type::BIG,
a36434b9 221 'where' => 'civicrm_group.name',
522a26c9 222 'table_name' => 'civicrm_group',
223 'entity' => 'Group',
224 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 225 'localizable' => 0,
c3fc2621
CW
226 ],
227 'title' => [
e501603b
TO
228 'name' => 'title',
229 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 230 'title' => ts('Group Title'),
215b423e 231 'description' => ts('Name of Group.'),
e501603b
TO
232 'maxlength' => 64,
233 'size' => CRM_Utils_Type::BIG,
a36434b9 234 'where' => 'civicrm_group.title',
522a26c9 235 'table_name' => 'civicrm_group',
236 'entity' => 'Group',
237 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 238 'localizable' => 1,
7da21f11 239 'html' => [
240 'type' => 'Text',
241 ],
c3fc2621
CW
242 ],
243 'description' => [
e501603b
TO
244 'name' => 'description',
245 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 246 'title' => ts('Group Description'),
215b423e 247 'description' => ts('Optional verbose description of the group.'),
e501603b
TO
248 'rows' => 2,
249 'cols' => 60,
a36434b9 250 'where' => 'civicrm_group.description',
522a26c9 251 'table_name' => 'civicrm_group',
252 'entity' => 'Group',
253 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 254 'localizable' => 0,
c3fc2621 255 'html' => [
e501603b 256 'type' => 'TextArea',
c3fc2621
CW
257 ],
258 ],
259 'source' => [
e501603b
TO
260 'name' => 'source',
261 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 262 'title' => ts('Group Source'),
215b423e 263 'description' => ts('Module or process which created this group.'),
e501603b
TO
264 'maxlength' => 64,
265 'size' => CRM_Utils_Type::BIG,
a36434b9 266 'where' => 'civicrm_group.source',
522a26c9 267 'table_name' => 'civicrm_group',
268 'entity' => 'Group',
269 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 270 'localizable' => 0,
c3fc2621
CW
271 ],
272 'saved_search_id' => [
e501603b
TO
273 'name' => 'saved_search_id',
274 'type' => CRM_Utils_Type::T_INT,
c3fc2621 275 'title' => ts('Saved Search ID'),
215b423e 276 'description' => ts('FK to saved search table.'),
a36434b9 277 'where' => 'civicrm_group.saved_search_id',
522a26c9 278 'table_name' => 'civicrm_group',
279 'entity' => 'Group',
280 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 281 'localizable' => 0,
e501603b 282 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
c3fc2621
CW
283 ],
284 'is_active' => [
e501603b
TO
285 'name' => 'is_active',
286 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 287 'title' => ts('Group Enabled'),
215b423e 288 'description' => ts('Is this entry active?'),
a36434b9 289 'where' => 'civicrm_group.is_active',
522a26c9 290 'table_name' => 'civicrm_group',
291 'entity' => 'Group',
292 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 293 'localizable' => 0,
c3fc2621
CW
294 ],
295 'visibility' => [
e501603b
TO
296 'name' => 'visibility',
297 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 298 'title' => ts('Group Visibility Setting'),
215b423e 299 'description' => ts('In what context(s) is this field visible.'),
e501603b
TO
300 'maxlength' => 24,
301 'size' => CRM_Utils_Type::MEDIUM,
a36434b9 302 'where' => 'civicrm_group.visibility',
e501603b 303 'default' => 'User and User Admin Only',
522a26c9 304 'table_name' => 'civicrm_group',
305 'entity' => 'Group',
306 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 307 'localizable' => 0,
c3fc2621 308 'html' => [
e501603b 309 'type' => 'Select',
c3fc2621
CW
310 ],
311 'pseudoconstant' => [
e501603b 312 'callback' => 'CRM_Core_SelectValues::groupVisibility',
e6ca0a57 313 ],
c3fc2621
CW
314 ],
315 'where_clause' => [
e501603b
TO
316 'name' => 'where_clause',
317 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 318 'title' => ts('Group Where Clause'),
215b423e 319 'description' => ts('the sql where clause if a saved search acl'),
a36434b9 320 'where' => 'civicrm_group.where_clause',
522a26c9 321 'table_name' => 'civicrm_group',
322 'entity' => 'Group',
323 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 324 'localizable' => 0,
c3fc2621
CW
325 ],
326 'select_tables' => [
e501603b
TO
327 'name' => 'select_tables',
328 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 329 'title' => ts('Tables For Select Clause'),
215b423e 330 'description' => ts('the tables to be included in a select data'),
a36434b9 331 'where' => 'civicrm_group.select_tables',
522a26c9 332 'table_name' => 'civicrm_group',
333 'entity' => 'Group',
334 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 335 'localizable' => 0,
2a5c9b4d 336 'serialize' => self::SERIALIZE_PHP,
c3fc2621
CW
337 ],
338 'where_tables' => [
e501603b
TO
339 'name' => 'where_tables',
340 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 341 'title' => ts('Tables For Where Clause'),
215b423e 342 'description' => ts('the tables to be included in the count statement'),
a36434b9 343 'where' => 'civicrm_group.where_tables',
522a26c9 344 'table_name' => 'civicrm_group',
345 'entity' => 'Group',
346 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 347 'localizable' => 0,
2a5c9b4d 348 'serialize' => self::SERIALIZE_PHP,
c3fc2621
CW
349 ],
350 'group_type' => [
e501603b
TO
351 'name' => 'group_type',
352 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 353 'title' => ts('Group Type'),
215b423e 354 'description' => ts('FK to group type'),
e501603b
TO
355 'maxlength' => 128,
356 'size' => CRM_Utils_Type::HUGE,
a36434b9 357 'where' => 'civicrm_group.group_type',
522a26c9 358 'table_name' => 'civicrm_group',
359 'entity' => 'Group',
360 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 361 'localizable' => 0,
2a5c9b4d 362 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
c3fc2621 363 'pseudoconstant' => [
e501603b
TO
364 'optionGroupName' => 'group_type',
365 'optionEditPath' => 'civicrm/admin/options/group_type',
e6ca0a57 366 ],
c3fc2621
CW
367 ],
368 'cache_date' => [
e501603b
TO
369 'name' => 'cache_date',
370 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 371 'title' => ts('Group Cache Date'),
215b423e 372 'description' => ts('Date when we created the cache for a smart group'),
c3fc2621 373 'required' => FALSE,
a36434b9 374 'where' => 'civicrm_group.cache_date',
522a26c9 375 'table_name' => 'civicrm_group',
376 'entity' => 'Group',
377 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 378 'localizable' => 0,
c3fc2621
CW
379 ],
380 'refresh_date' => [
e501603b
TO
381 'name' => 'refresh_date',
382 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 383 'title' => ts('Next Group Refresh Time'),
215b423e 384 'description' => ts('Date and time when we need to refresh the cache next.'),
c3fc2621 385 'required' => FALSE,
a36434b9 386 'where' => 'civicrm_group.refresh_date',
522a26c9 387 'table_name' => 'civicrm_group',
388 'entity' => 'Group',
389 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 390 'localizable' => 0,
c3fc2621
CW
391 ],
392 'parents' => [
e501603b
TO
393 'name' => 'parents',
394 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 395 'title' => ts('Group Parents'),
215b423e 396 'description' => ts('IDs of the parent(s)'),
a36434b9 397 'where' => 'civicrm_group.parents',
522a26c9 398 'table_name' => 'civicrm_group',
399 'entity' => 'Group',
400 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 401 'localizable' => 0,
30208fab 402 'serialize' => self::SERIALIZE_COMMA,
1678a63b 403 'pseudoconstant' => [
404 'callback' => 'CRM_Core_PseudoConstant::allGroup',
e6ca0a57 405 ],
c3fc2621
CW
406 ],
407 'children' => [
e501603b
TO
408 'name' => 'children',
409 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 410 'title' => ts('Group Children'),
215b423e 411 'description' => ts('IDs of the child(ren)'),
a36434b9 412 'where' => 'civicrm_group.children',
522a26c9 413 'table_name' => 'civicrm_group',
414 'entity' => 'Group',
415 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 416 'localizable' => 0,
c3fc2621
CW
417 ],
418 'is_hidden' => [
e501603b
TO
419 'name' => 'is_hidden',
420 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 421 'title' => ts('Group is Hidden'),
215b423e 422 'description' => ts('Is this group hidden?'),
a36434b9 423 'where' => 'civicrm_group.is_hidden',
45a83e42 424 'default' => '0',
522a26c9 425 'table_name' => 'civicrm_group',
426 'entity' => 'Group',
427 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 428 'localizable' => 0,
c3fc2621
CW
429 ],
430 'is_reserved' => [
e501603b
TO
431 'name' => 'is_reserved',
432 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 433 'title' => ts('Group is Reserved'),
a36434b9 434 'where' => 'civicrm_group.is_reserved',
45a83e42 435 'default' => '0',
522a26c9 436 'table_name' => 'civicrm_group',
437 'entity' => 'Group',
438 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 439 'localizable' => 0,
c3fc2621
CW
440 ],
441 'created_id' => [
e501603b
TO
442 'name' => 'created_id',
443 'type' => CRM_Utils_Type::T_INT,
c3fc2621 444 'title' => ts('Group Created By'),
215b423e 445 'description' => ts('FK to contact table.'),
a36434b9 446 'where' => 'civicrm_group.created_id',
522a26c9 447 'table_name' => 'civicrm_group',
448 'entity' => 'Group',
449 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 450 'localizable' => 0,
e501603b 451 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621
CW
452 ],
453 'modified_id' => [
e501603b
TO
454 'name' => 'modified_id',
455 'type' => CRM_Utils_Type::T_INT,
c3fc2621 456 'title' => ts('Group Modified By'),
215b423e 457 'description' => ts('FK to contact table.'),
a36434b9 458 'where' => 'civicrm_group.modified_id',
522a26c9 459 'table_name' => 'civicrm_group',
460 'entity' => 'Group',
461 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 462 'localizable' => 0,
e501603b 463 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621
CW
464 ],
465 ];
346aaaba 466 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 467 }
346aaaba 468 return Civi::$statics[__CLASS__]['fields'];
e501603b 469 }
c3fc2621 470
e501603b 471 /**
bd8e0b14 472 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
473 *
474 * @return array
bd8e0b14 475 * Array(string $name => string $uniqueName).
e501603b 476 */
c3fc2621 477 public static function &fieldKeys() {
bd8e0b14
TO
478 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
479 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 480 }
bd8e0b14 481 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 482 }
c3fc2621 483
e501603b
TO
484 /**
485 * Returns the names of this table
486 *
487 * @return string
488 */
c3fc2621 489 public static function getTableName() {
e501603b
TO
490 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
491 }
c3fc2621 492
e501603b
TO
493 /**
494 * Returns if this table needs to be logged
495 *
c3fc2621 496 * @return bool
e501603b 497 */
c3fc2621 498 public function getLog() {
e501603b
TO
499 return self::$_log;
500 }
c3fc2621 501
e501603b
TO
502 /**
503 * Returns the list of fields that can be imported
504 *
505 * @param bool $prefix
506 *
507 * @return array
508 */
c3fc2621
CW
509 public static function &import($prefix = FALSE) {
510 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group', $prefix, []);
60808919 511 return $r;
e501603b 512 }
c3fc2621 513
e501603b
TO
514 /**
515 * Returns the list of fields that can be exported
516 *
517 * @param bool $prefix
518 *
519 * @return array
520 */
c3fc2621
CW
521 public static function &export($prefix = FALSE) {
522 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group', $prefix, []);
60808919 523 return $r;
e501603b 524 }
c3fc2621 525
e7a6b91a
AS
526 /**
527 * Returns the list of indices
c3fc2621
CW
528 *
529 * @param bool $localize
530 *
531 * @return array
e7a6b91a
AS
532 */
533 public static function indices($localize = TRUE) {
c3fc2621
CW
534 $indices = [
535 'index_group_type' => [
e7a6b91a 536 'name' => 'index_group_type',
c3fc2621 537 'field' => [
e7a6b91a 538 0 => 'group_type',
c3fc2621
CW
539 ],
540 'localizable' => FALSE,
e7a6b91a 541 'sig' => 'civicrm_group::0::group_type',
c3fc2621
CW
542 ],
543 'UI_title' => [
e7a6b91a 544 'name' => 'UI_title',
c3fc2621 545 'field' => [
e7a6b91a 546 0 => 'title',
c3fc2621
CW
547 ],
548 'localizable' => TRUE,
549 'unique' => TRUE,
e7a6b91a 550 'sig' => 'civicrm_group::1::title',
c3fc2621
CW
551 ],
552 'UI_name' => [
e7a6b91a 553 'name' => 'UI_name',
c3fc2621 554 'field' => [
e7a6b91a 555 0 => 'name',
c3fc2621
CW
556 ],
557 'localizable' => FALSE,
558 'unique' => TRUE,
e7a6b91a 559 'sig' => 'civicrm_group::1::name',
c3fc2621
CW
560 ],
561 ];
e7a6b91a
AS
562 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
563 }
c3fc2621 564
e501603b 565}