Merge pull request #23144 from colemanw/noMoreSaveButtonInApiExplorer
[civicrm-core.git] / CRM / Contact / DAO / Group.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Contact/Group.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
c1e814c7 9 * (GenCodeChecksum:8b5d08ec2b844a6b9167fa80a590a58c)
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 {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.1';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_group';
c3fc2621 25
449c4e6b
CW
26 /**
27 * Icon associated with this entity.
28 *
29 * @var string
30 */
31 public static $_icon = 'fa-users';
32
8ab43c93
CW
33 /**
34 * Field to show when displaying a record.
35 *
36 * @var string
37 */
38 public static $_labelField = 'title';
39
e501603b 40 /**
f41f0342 41 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 42 *
c3fc2621 43 * @var bool
e501603b 44 */
fa45b5b9 45 public static $_log = TRUE;
c3fc2621 46
a7bd99ff
CW
47 /**
48 * Paths for accessing this entity in the UI.
49 *
50 * @var string[]
51 */
52 protected static $_paths = [
5c385299 53 'add' => 'civicrm/group/add?reset=1',
5c2ba7c7
EM
54 'view' => 'civicrm/group/search?force=1&context=smog&gid=[id]&component_mode=1',
55 'update' => 'civicrm/group?reset=1&action=update&id=[id]',
56 'delete' => 'civicrm/group?reset=1&action=delete&id=[id]',
a7bd99ff
CW
57 ];
58
e501603b
TO
59 /**
60 * Group ID
61 *
28979d65
CW
62 * @var int|string|null
63 * (SQL type: int unsigned)
64 * Note that values will be retrieved from the database as a string.
e501603b
TO
65 */
66 public $id;
c3fc2621 67
e501603b
TO
68 /**
69 * Internal name of Group.
70 *
28979d65
CW
71 * @var string|null
72 * (SQL type: varchar(64))
73 * Note that values will be retrieved from the database as a string.
e501603b
TO
74 */
75 public $name;
c3fc2621 76
e501603b
TO
77 /**
78 * Name of Group.
79 *
28979d65
CW
80 * @var string|null
81 * (SQL type: varchar(255))
82 * Note that values will be retrieved from the database as a string.
e501603b
TO
83 */
84 public $title;
c3fc2621 85
e501603b
TO
86 /**
87 * Optional verbose description of the group.
88 *
28979d65
CW
89 * @var string|null
90 * (SQL type: text)
91 * Note that values will be retrieved from the database as a string.
e501603b
TO
92 */
93 public $description;
c3fc2621 94
e501603b
TO
95 /**
96 * Module or process which created this group.
97 *
28979d65
CW
98 * @var string|null
99 * (SQL type: varchar(64))
100 * Note that values will be retrieved from the database as a string.
e501603b
TO
101 */
102 public $source;
c3fc2621 103
e501603b
TO
104 /**
105 * FK to saved search table.
106 *
28979d65
CW
107 * @var int|string|null
108 * (SQL type: int unsigned)
109 * Note that values will be retrieved from the database as a string.
e501603b
TO
110 */
111 public $saved_search_id;
c3fc2621 112
e501603b
TO
113 /**
114 * Is this entry active?
115 *
c1e814c7 116 * @var bool|string
28979d65
CW
117 * (SQL type: tinyint)
118 * Note that values will be retrieved from the database as a string.
e501603b
TO
119 */
120 public $is_active;
c3fc2621 121
e501603b
TO
122 /**
123 * In what context(s) is this field visible.
124 *
28979d65
CW
125 * @var string|null
126 * (SQL type: varchar(24))
127 * Note that values will be retrieved from the database as a string.
e501603b
TO
128 */
129 public $visibility;
c3fc2621 130
e501603b
TO
131 /**
132 * the sql where clause if a saved search acl
133 *
28979d65
CW
134 * @var string|null
135 * (SQL type: text)
136 * Note that values will be retrieved from the database as a string.
e501603b
TO
137 */
138 public $where_clause;
c3fc2621 139
e501603b
TO
140 /**
141 * the tables to be included in a select data
142 *
28979d65
CW
143 * @var string|null
144 * (SQL type: text)
145 * Note that values will be retrieved from the database as a string.
e501603b
TO
146 */
147 public $select_tables;
c3fc2621 148
e501603b
TO
149 /**
150 * the tables to be included in the count statement
151 *
28979d65
CW
152 * @var string|null
153 * (SQL type: text)
154 * Note that values will be retrieved from the database as a string.
e501603b
TO
155 */
156 public $where_tables;
c3fc2621 157
e501603b
TO
158 /**
159 * FK to group type
160 *
28979d65
CW
161 * @var string|null
162 * (SQL type: varchar(128))
163 * Note that values will be retrieved from the database as a string.
e501603b
TO
164 */
165 public $group_type;
c3fc2621 166
e501603b
TO
167 /**
168 * Date when we created the cache for a smart group
169 *
28979d65
CW
170 * @var string
171 * (SQL type: timestamp)
172 * Note that values will be retrieved from the database as a string.
e501603b
TO
173 */
174 public $cache_date;
c3fc2621 175
e501603b
TO
176 /**
177 * Date and time when we need to refresh the cache next.
178 *
28979d65
CW
179 * @var string
180 * (SQL type: timestamp)
181 * Note that values will be retrieved from the database as a string.
e501603b
TO
182 */
183 public $refresh_date;
c3fc2621 184
e501603b
TO
185 /**
186 * IDs of the parent(s)
187 *
28979d65
CW
188 * @var string|null
189 * (SQL type: text)
190 * Note that values will be retrieved from the database as a string.
e501603b
TO
191 */
192 public $parents;
c3fc2621 193
e501603b
TO
194 /**
195 * IDs of the child(ren)
196 *
28979d65
CW
197 * @var string|null
198 * (SQL type: text)
199 * Note that values will be retrieved from the database as a string.
e501603b
TO
200 */
201 public $children;
c3fc2621 202
e501603b
TO
203 /**
204 * Is this group hidden?
205 *
c1e814c7 206 * @var bool|string
28979d65
CW
207 * (SQL type: tinyint)
208 * Note that values will be retrieved from the database as a string.
e501603b
TO
209 */
210 public $is_hidden;
c3fc2621 211
e501603b 212 /**
c1e814c7 213 * @var bool|string
28979d65
CW
214 * (SQL type: tinyint)
215 * Note that values will be retrieved from the database as a string.
e501603b
TO
216 */
217 public $is_reserved;
c3fc2621 218
e501603b
TO
219 /**
220 * FK to contact table.
221 *
28979d65
CW
222 * @var int|string|null
223 * (SQL type: int unsigned)
224 * Note that values will be retrieved from the database as a string.
e501603b
TO
225 */
226 public $created_id;
c3fc2621 227
e501603b
TO
228 /**
229 * FK to contact table.
230 *
28979d65
CW
231 * @var int|string|null
232 * (SQL type: int unsigned)
233 * Note that values will be retrieved from the database as a string.
e501603b
TO
234 */
235 public $modified_id;
c3fc2621 236
35fd9d21
SL
237 /**
238 * Alternative public title for this Group.
239 *
28979d65
CW
240 * @var string|null
241 * (SQL type: varchar(255))
242 * Note that values will be retrieved from the database as a string.
35fd9d21
SL
243 */
244 public $frontend_title;
245
246 /**
247 * Alternative public description of the group.
248 *
28979d65
CW
249 * @var string|null
250 * (SQL type: text)
251 * Note that values will be retrieved from the database as a string.
35fd9d21
SL
252 */
253 public $frontend_description;
254
e501603b 255 /**
f41f0342 256 * Class constructor.
e501603b 257 */
c3fc2621 258 public function __construct() {
e501603b
TO
259 $this->__table = 'civicrm_group';
260 parent::__construct();
261 }
c3fc2621 262
449c4e6b
CW
263 /**
264 * Returns localized title of this entity.
7b66c3b5
AH
265 *
266 * @param bool $plural
267 * Whether to return the plural version of the title.
449c4e6b 268 */
7b66c3b5
AH
269 public static function getEntityTitle($plural = FALSE) {
270 return $plural ? ts('Groups') : ts('Group');
449c4e6b
CW
271 }
272
e501603b 273 /**
f41f0342 274 * Returns foreign keys and entity references.
e501603b
TO
275 *
276 * @return array
277 * [CRM_Core_Reference_Interface]
278 */
c3fc2621 279 public static function getReferenceColumns() {
346aaaba 280 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 281 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
282 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'saved_search_id', 'civicrm_saved_search', 'id');
283 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
284 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'modified_id', 'civicrm_contact', 'id');
346aaaba 285 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 286 }
346aaaba 287 return Civi::$statics[__CLASS__]['links'];
e501603b 288 }
c3fc2621 289
e501603b
TO
290 /**
291 * Returns all the column names of this table
292 *
293 * @return array
294 */
c3fc2621 295 public static function &fields() {
346aaaba 296 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
297 Civi::$statics[__CLASS__]['fields'] = [
298 'id' => [
e501603b
TO
299 'name' => 'id',
300 'type' => CRM_Utils_Type::T_INT,
c3fc2621 301 'title' => ts('Group ID'),
215b423e 302 'description' => ts('Group ID'),
c3fc2621 303 'required' => TRUE,
a36434b9 304 'where' => 'civicrm_group.id',
522a26c9 305 'table_name' => 'civicrm_group',
306 'entity' => 'Group',
307 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 308 'localizable' => 0,
2cbbebe8
A
309 'html' => [
310 'type' => 'Number',
311 ],
1fe423d6 312 'readonly' => TRUE,
a9d0587b 313 'add' => '1.1',
c3fc2621
CW
314 ],
315 'name' => [
e501603b
TO
316 'name' => 'name',
317 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 318 'title' => ts('Group Name'),
215b423e 319 'description' => ts('Internal name of Group.'),
e501603b
TO
320 'maxlength' => 64,
321 'size' => CRM_Utils_Type::BIG,
a36434b9 322 'where' => 'civicrm_group.name',
522a26c9 323 'table_name' => 'civicrm_group',
324 'entity' => 'Group',
325 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 326 'localizable' => 0,
a9d0587b 327 'add' => '1.1',
c3fc2621
CW
328 ],
329 'title' => [
e501603b
TO
330 'name' => 'title',
331 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 332 'title' => ts('Group Title'),
215b423e 333 'description' => ts('Name of Group.'),
35fd9d21
SL
334 'maxlength' => 255,
335 'size' => CRM_Utils_Type::HUGE,
a36434b9 336 'where' => 'civicrm_group.title',
522a26c9 337 'table_name' => 'civicrm_group',
338 'entity' => 'Group',
339 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 340 'localizable' => 1,
7da21f11 341 'html' => [
342 'type' => 'Text',
343 ],
a9d0587b 344 'add' => '1.1',
c3fc2621
CW
345 ],
346 'description' => [
e501603b
TO
347 'name' => 'description',
348 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 349 'title' => ts('Group Description'),
215b423e 350 'description' => ts('Optional verbose description of the group.'),
e501603b
TO
351 'rows' => 2,
352 'cols' => 60,
a36434b9 353 'where' => 'civicrm_group.description',
522a26c9 354 'table_name' => 'civicrm_group',
355 'entity' => 'Group',
356 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 357 'localizable' => 0,
c3fc2621 358 'html' => [
e501603b 359 'type' => 'TextArea',
c3fc2621 360 ],
a9d0587b 361 'add' => '1.1',
c3fc2621
CW
362 ],
363 'source' => [
e501603b
TO
364 'name' => 'source',
365 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 366 'title' => ts('Group Source'),
215b423e 367 'description' => ts('Module or process which created this group.'),
e501603b
TO
368 'maxlength' => 64,
369 'size' => CRM_Utils_Type::BIG,
a36434b9 370 'where' => 'civicrm_group.source',
522a26c9 371 'table_name' => 'civicrm_group',
372 'entity' => 'Group',
373 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 374 'localizable' => 0,
a9d0587b 375 'add' => '1.1',
c3fc2621
CW
376 ],
377 'saved_search_id' => [
e501603b
TO
378 'name' => 'saved_search_id',
379 'type' => CRM_Utils_Type::T_INT,
c3fc2621 380 'title' => ts('Saved Search ID'),
215b423e 381 'description' => ts('FK to saved search table.'),
a36434b9 382 'where' => 'civicrm_group.saved_search_id',
522a26c9 383 'table_name' => 'civicrm_group',
384 'entity' => 'Group',
385 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 386 'localizable' => 0,
e501603b 387 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
2cbbebe8
A
388 'html' => [
389 'label' => ts("Saved Search"),
390 ],
a9d0587b 391 'add' => '1.1',
c3fc2621
CW
392 ],
393 'is_active' => [
e501603b
TO
394 'name' => 'is_active',
395 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 396 'title' => ts('Group Enabled'),
215b423e 397 'description' => ts('Is this entry active?'),
c1e814c7 398 'required' => TRUE,
a36434b9 399 'where' => 'civicrm_group.is_active',
c1e814c7 400 'default' => '1',
522a26c9 401 'table_name' => 'civicrm_group',
402 'entity' => 'Group',
403 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 404 'localizable' => 0,
a9d0587b 405 'add' => '1.1',
c3fc2621
CW
406 ],
407 'visibility' => [
e501603b
TO
408 'name' => 'visibility',
409 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 410 'title' => ts('Group Visibility Setting'),
215b423e 411 'description' => ts('In what context(s) is this field visible.'),
e501603b
TO
412 'maxlength' => 24,
413 'size' => CRM_Utils_Type::MEDIUM,
a36434b9 414 'where' => 'civicrm_group.visibility',
e501603b 415 'default' => 'User and User Admin Only',
522a26c9 416 'table_name' => 'civicrm_group',
417 'entity' => 'Group',
418 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 419 'localizable' => 0,
c3fc2621 420 'html' => [
e501603b 421 'type' => 'Select',
c3fc2621
CW
422 ],
423 'pseudoconstant' => [
e501603b 424 'callback' => 'CRM_Core_SelectValues::groupVisibility',
e6ca0a57 425 ],
a9d0587b 426 'add' => '1.2',
c3fc2621
CW
427 ],
428 'where_clause' => [
e501603b
TO
429 'name' => 'where_clause',
430 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 431 'title' => ts('Group Where Clause'),
215b423e 432 'description' => ts('the sql where clause if a saved search acl'),
a36434b9 433 'where' => 'civicrm_group.where_clause',
522a26c9 434 'table_name' => 'civicrm_group',
435 'entity' => 'Group',
436 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 437 'localizable' => 0,
58b0bf5a 438 'readonly' => TRUE,
a9d0587b 439 'add' => '1.6',
c3fc2621
CW
440 ],
441 'select_tables' => [
e501603b
TO
442 'name' => 'select_tables',
443 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 444 'title' => ts('Tables For Select Clause'),
215b423e 445 'description' => ts('the tables to be included in a select data'),
a36434b9 446 'where' => 'civicrm_group.select_tables',
522a26c9 447 'table_name' => 'civicrm_group',
448 'entity' => 'Group',
449 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 450 'localizable' => 0,
2a5c9b4d 451 'serialize' => self::SERIALIZE_PHP,
58b0bf5a 452 'readonly' => TRUE,
a9d0587b 453 'add' => '1.6',
c3fc2621
CW
454 ],
455 'where_tables' => [
e501603b
TO
456 'name' => 'where_tables',
457 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 458 'title' => ts('Tables For Where Clause'),
215b423e 459 'description' => ts('the tables to be included in the count statement'),
a36434b9 460 'where' => 'civicrm_group.where_tables',
522a26c9 461 'table_name' => 'civicrm_group',
462 'entity' => 'Group',
463 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 464 'localizable' => 0,
2a5c9b4d 465 'serialize' => self::SERIALIZE_PHP,
58b0bf5a 466 'readonly' => TRUE,
a9d0587b 467 'add' => '1.6',
c3fc2621
CW
468 ],
469 'group_type' => [
e501603b
TO
470 'name' => 'group_type',
471 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 472 'title' => ts('Group Type'),
215b423e 473 'description' => ts('FK to group type'),
e501603b
TO
474 'maxlength' => 128,
475 'size' => CRM_Utils_Type::HUGE,
a36434b9 476 'where' => 'civicrm_group.group_type',
522a26c9 477 'table_name' => 'civicrm_group',
478 'entity' => 'Group',
479 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 480 'localizable' => 0,
2a5c9b4d 481 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
c3fc2621 482 'pseudoconstant' => [
e501603b
TO
483 'optionGroupName' => 'group_type',
484 'optionEditPath' => 'civicrm/admin/options/group_type',
e6ca0a57 485 ],
a9d0587b 486 'add' => '1.9',
c3fc2621
CW
487 ],
488 'cache_date' => [
e501603b
TO
489 'name' => 'cache_date',
490 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 491 'title' => ts('Group Cache Date'),
215b423e 492 'description' => ts('Date when we created the cache for a smart group'),
c3fc2621 493 'required' => FALSE,
a36434b9 494 'where' => 'civicrm_group.cache_date',
522a26c9 495 'table_name' => 'civicrm_group',
496 'entity' => 'Group',
497 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 498 'localizable' => 0,
58b0bf5a 499 'readonly' => TRUE,
a9d0587b 500 'add' => '2.1',
c3fc2621
CW
501 ],
502 'refresh_date' => [
e501603b
TO
503 'name' => 'refresh_date',
504 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 505 'title' => ts('Next Group Refresh Time'),
215b423e 506 'description' => ts('Date and time when we need to refresh the cache next.'),
c3fc2621 507 'required' => FALSE,
a36434b9 508 'where' => 'civicrm_group.refresh_date',
522a26c9 509 'table_name' => 'civicrm_group',
510 'entity' => 'Group',
511 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 512 'localizable' => 0,
58b0bf5a 513 'readonly' => TRUE,
a9d0587b 514 'add' => '4.3',
c3fc2621
CW
515 ],
516 'parents' => [
e501603b
TO
517 'name' => 'parents',
518 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 519 'title' => ts('Group Parents'),
215b423e 520 'description' => ts('IDs of the parent(s)'),
a36434b9 521 'where' => 'civicrm_group.parents',
522a26c9 522 'table_name' => 'civicrm_group',
523 'entity' => 'Group',
524 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 525 'localizable' => 0,
30208fab 526 'serialize' => self::SERIALIZE_COMMA,
1678a63b 527 'pseudoconstant' => [
528 'callback' => 'CRM_Core_PseudoConstant::allGroup',
e6ca0a57 529 ],
a9d0587b 530 'add' => '2.1',
c3fc2621
CW
531 ],
532 'children' => [
e501603b
TO
533 'name' => 'children',
534 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 535 'title' => ts('Group Children'),
215b423e 536 'description' => ts('IDs of the child(ren)'),
a36434b9 537 'where' => 'civicrm_group.children',
522a26c9 538 'table_name' => 'civicrm_group',
539 'entity' => 'Group',
540 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 541 'localizable' => 0,
a9d0587b 542 'add' => '2.1',
c3fc2621
CW
543 ],
544 'is_hidden' => [
e501603b
TO
545 'name' => 'is_hidden',
546 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 547 'title' => ts('Group is Hidden'),
215b423e 548 'description' => ts('Is this group hidden?'),
c1e814c7 549 'required' => TRUE,
a36434b9 550 'where' => 'civicrm_group.is_hidden',
45a83e42 551 'default' => '0',
522a26c9 552 'table_name' => 'civicrm_group',
553 'entity' => 'Group',
554 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 555 'localizable' => 0,
a9d0587b 556 'add' => '2.2',
c3fc2621
CW
557 ],
558 'is_reserved' => [
e501603b
TO
559 'name' => 'is_reserved',
560 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 561 'title' => ts('Group is Reserved'),
c1e814c7 562 'required' => TRUE,
a36434b9 563 'where' => 'civicrm_group.is_reserved',
45a83e42 564 'default' => '0',
522a26c9 565 'table_name' => 'civicrm_group',
566 'entity' => 'Group',
567 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 568 'localizable' => 0,
a9d0587b 569 'add' => '4.2',
c3fc2621
CW
570 ],
571 'created_id' => [
e501603b
TO
572 'name' => 'created_id',
573 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 574 'title' => ts('Created By Contact ID'),
215b423e 575 'description' => ts('FK to contact table.'),
a36434b9 576 'where' => 'civicrm_group.created_id',
522a26c9 577 'table_name' => 'civicrm_group',
578 'entity' => 'Group',
579 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 580 'localizable' => 0,
e501603b 581 'FKClassName' => 'CRM_Contact_DAO_Contact',
2cbbebe8
A
582 'html' => [
583 'label' => ts("Created By"),
584 ],
a9d0587b 585 'add' => '4.3',
c3fc2621
CW
586 ],
587 'modified_id' => [
e501603b
TO
588 'name' => 'modified_id',
589 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 590 'title' => ts('Modified By Contact ID'),
215b423e 591 'description' => ts('FK to contact table.'),
a36434b9 592 'where' => 'civicrm_group.modified_id',
522a26c9 593 'table_name' => 'civicrm_group',
594 'entity' => 'Group',
595 'bao' => 'CRM_Contact_BAO_Group',
6a7e5e5d 596 'localizable' => 0,
e501603b 597 'FKClassName' => 'CRM_Contact_DAO_Contact',
2cbbebe8
A
598 'html' => [
599 'label' => ts("Modified By"),
600 ],
a0e733f3 601 'readonly' => TRUE,
a9d0587b 602 'add' => '4.5',
c3fc2621 603 ],
35fd9d21
SL
604 'frontend_title' => [
605 'name' => 'frontend_title',
606 'type' => CRM_Utils_Type::T_STRING,
607 'title' => ts('Public Group Title'),
608 'description' => ts('Alternative public title for this Group.'),
609 'maxlength' => 255,
610 'size' => CRM_Utils_Type::HUGE,
611 'where' => 'civicrm_group.frontend_title',
5fb0de1f 612 'default' => NULL,
35fd9d21
SL
613 'table_name' => 'civicrm_group',
614 'entity' => 'Group',
615 'bao' => 'CRM_Contact_BAO_Group',
616 'localizable' => 1,
617 'html' => [
618 'type' => 'Text',
619 ],
620 'add' => '5.31',
621 ],
622 'frontend_description' => [
623 'name' => 'frontend_description',
624 'type' => CRM_Utils_Type::T_TEXT,
625 'title' => ts('Public Group Description'),
626 'description' => ts('Alternative public description of the group.'),
627 'rows' => 2,
628 'cols' => 60,
629 'where' => 'civicrm_group.frontend_description',
5fb0de1f 630 'default' => NULL,
35fd9d21
SL
631 'table_name' => 'civicrm_group',
632 'entity' => 'Group',
633 'bao' => 'CRM_Contact_BAO_Group',
634 'localizable' => 1,
635 'html' => [
636 'type' => 'TextArea',
637 ],
638 'add' => '5.31',
639 ],
c3fc2621 640 ];
346aaaba 641 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 642 }
346aaaba 643 return Civi::$statics[__CLASS__]['fields'];
e501603b 644 }
c3fc2621 645
e501603b 646 /**
bd8e0b14 647 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
648 *
649 * @return array
bd8e0b14 650 * Array(string $name => string $uniqueName).
e501603b 651 */
c3fc2621 652 public static function &fieldKeys() {
bd8e0b14
TO
653 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
654 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 655 }
bd8e0b14 656 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 657 }
c3fc2621 658
e501603b
TO
659 /**
660 * Returns the names of this table
661 *
662 * @return string
663 */
c3fc2621 664 public static function getTableName() {
e501603b
TO
665 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
666 }
c3fc2621 667
e501603b
TO
668 /**
669 * Returns if this table needs to be logged
670 *
c3fc2621 671 * @return bool
e501603b 672 */
c3fc2621 673 public function getLog() {
e501603b
TO
674 return self::$_log;
675 }
c3fc2621 676
e501603b
TO
677 /**
678 * Returns the list of fields that can be imported
679 *
680 * @param bool $prefix
681 *
682 * @return array
683 */
c3fc2621
CW
684 public static function &import($prefix = FALSE) {
685 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group', $prefix, []);
60808919 686 return $r;
e501603b 687 }
c3fc2621 688
e501603b
TO
689 /**
690 * Returns the list of fields that can be exported
691 *
692 * @param bool $prefix
693 *
694 * @return array
695 */
c3fc2621
CW
696 public static function &export($prefix = FALSE) {
697 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group', $prefix, []);
60808919 698 return $r;
e501603b 699 }
c3fc2621 700
e7a6b91a
AS
701 /**
702 * Returns the list of indices
c3fc2621
CW
703 *
704 * @param bool $localize
705 *
706 * @return array
e7a6b91a
AS
707 */
708 public static function indices($localize = TRUE) {
c3fc2621 709 $indices = [
b29bfb6a 710 'UI_cache_date' => [
711 'name' => 'UI_cache_date',
712 'field' => [
713 0 => 'cache_date',
714 ],
715 'localizable' => FALSE,
716 'sig' => 'civicrm_group::0::cache_date',
717 ],
c3fc2621 718 'index_group_type' => [
e7a6b91a 719 'name' => 'index_group_type',
c3fc2621 720 'field' => [
e7a6b91a 721 0 => 'group_type',
c3fc2621
CW
722 ],
723 'localizable' => FALSE,
e7a6b91a 724 'sig' => 'civicrm_group::0::group_type',
c3fc2621
CW
725 ],
726 'UI_title' => [
e7a6b91a 727 'name' => 'UI_title',
c3fc2621 728 'field' => [
e7a6b91a 729 0 => 'title',
c3fc2621
CW
730 ],
731 'localizable' => TRUE,
732 'unique' => TRUE,
e7a6b91a 733 'sig' => 'civicrm_group::1::title',
c3fc2621
CW
734 ],
735 'UI_name' => [
e7a6b91a 736 'name' => 'UI_name',
c3fc2621 737 'field' => [
e7a6b91a 738 0 => 'name',
c3fc2621
CW
739 ],
740 'localizable' => FALSE,
741 'unique' => TRUE,
e7a6b91a 742 'sig' => 'civicrm_group::1::name',
c3fc2621
CW
743 ],
744 ];
e7a6b91a
AS
745 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
746 }
c3fc2621 747
e501603b 748}