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