5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Contact/Group.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:a8a3812a392b7544441cdbe1f9500f21)
13 * Database access object for the Group entity.
15 class CRM_Contact_DAO_Group
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_group';
25 * Icon associated with this entity.
29 public static $_icon = 'fa-users';
32 * Should CiviCRM log any modifications to this table in the civicrm_log table.
36 public static $_log = TRUE;
46 * Internal name of Group.
60 * Optional verbose description of the group.
67 * Module or process which created this group.
74 * FK to saved search table.
78 public $saved_search_id;
81 * Is this entry active?
88 * In what context(s) is this field visible.
95 * the sql where clause if a saved search acl
102 * the tables to be included in a select data
106 public $select_tables;
109 * the tables to be included in the count statement
113 public $where_tables;
123 * Date when we created the cache for a smart group
130 * Date and time when we need to refresh the cache next.
134 public $refresh_date;
137 * IDs of the parent(s)
144 * IDs of the child(ren)
151 * Is this group hidden?
163 * FK to contact table.
170 * FK to contact table.
179 public function __construct() {
180 $this->__table
= 'civicrm_group';
181 parent
::__construct();
185 * Returns localized title of this entity.
187 public static function getEntityTitle() {
192 * Returns foreign keys and entity references.
195 * [CRM_Core_Reference_Interface]
197 public static function getReferenceColumns() {
198 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
199 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
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');
203 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
205 return Civi
::$statics[__CLASS__
]['links'];
209 * Returns all the column names of this table
213 public static function &fields() {
214 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
215 Civi
::$statics[__CLASS__
]['fields'] = [
218 'type' => CRM_Utils_Type
::T_INT
,
219 'title' => ts('Group ID'),
220 'description' => ts('Group ID'),
222 'where' => 'civicrm_group.id',
223 'table_name' => 'civicrm_group',
225 'bao' => 'CRM_Contact_BAO_Group',
231 'type' => CRM_Utils_Type
::T_STRING
,
232 'title' => ts('Group Name'),
233 'description' => ts('Internal name of Group.'),
235 'size' => CRM_Utils_Type
::BIG
,
236 'where' => 'civicrm_group.name',
237 'table_name' => 'civicrm_group',
239 'bao' => 'CRM_Contact_BAO_Group',
245 'type' => CRM_Utils_Type
::T_STRING
,
246 'title' => ts('Group Title'),
247 'description' => ts('Name of Group.'),
249 'size' => CRM_Utils_Type
::BIG
,
250 'where' => 'civicrm_group.title',
251 'table_name' => 'civicrm_group',
253 'bao' => 'CRM_Contact_BAO_Group',
261 'name' => 'description',
262 'type' => CRM_Utils_Type
::T_TEXT
,
263 'title' => ts('Group Description'),
264 'description' => ts('Optional verbose description of the group.'),
267 'where' => 'civicrm_group.description',
268 'table_name' => 'civicrm_group',
270 'bao' => 'CRM_Contact_BAO_Group',
273 'type' => 'TextArea',
279 'type' => CRM_Utils_Type
::T_STRING
,
280 'title' => ts('Group Source'),
281 'description' => ts('Module or process which created this group.'),
283 'size' => CRM_Utils_Type
::BIG
,
284 'where' => 'civicrm_group.source',
285 'table_name' => 'civicrm_group',
287 'bao' => 'CRM_Contact_BAO_Group',
291 'saved_search_id' => [
292 'name' => 'saved_search_id',
293 'type' => CRM_Utils_Type
::T_INT
,
294 'title' => ts('Saved Search ID'),
295 'description' => ts('FK to saved search table.'),
296 'where' => 'civicrm_group.saved_search_id',
297 'table_name' => 'civicrm_group',
299 'bao' => 'CRM_Contact_BAO_Group',
301 'FKClassName' => 'CRM_Contact_DAO_SavedSearch',
305 'name' => 'is_active',
306 'type' => CRM_Utils_Type
::T_BOOLEAN
,
307 'title' => ts('Group Enabled'),
308 'description' => ts('Is this entry active?'),
309 'where' => 'civicrm_group.is_active',
310 'table_name' => 'civicrm_group',
312 'bao' => 'CRM_Contact_BAO_Group',
317 'name' => 'visibility',
318 'type' => CRM_Utils_Type
::T_STRING
,
319 'title' => ts('Group Visibility Setting'),
320 'description' => ts('In what context(s) is this field visible.'),
322 'size' => CRM_Utils_Type
::MEDIUM
,
323 'where' => 'civicrm_group.visibility',
324 'default' => 'User and User Admin Only',
325 'table_name' => 'civicrm_group',
327 'bao' => 'CRM_Contact_BAO_Group',
332 'pseudoconstant' => [
333 'callback' => 'CRM_Core_SelectValues::groupVisibility',
338 'name' => 'where_clause',
339 'type' => CRM_Utils_Type
::T_TEXT
,
340 'title' => ts('Group Where Clause'),
341 'description' => ts('the sql where clause if a saved search acl'),
342 'where' => 'civicrm_group.where_clause',
343 'table_name' => 'civicrm_group',
345 'bao' => 'CRM_Contact_BAO_Group',
350 'name' => 'select_tables',
351 'type' => CRM_Utils_Type
::T_TEXT
,
352 'title' => ts('Tables For Select Clause'),
353 'description' => ts('the tables to be included in a select data'),
354 'where' => 'civicrm_group.select_tables',
355 'table_name' => 'civicrm_group',
357 'bao' => 'CRM_Contact_BAO_Group',
359 'serialize' => self
::SERIALIZE_PHP
,
363 'name' => 'where_tables',
364 'type' => CRM_Utils_Type
::T_TEXT
,
365 'title' => ts('Tables For Where Clause'),
366 'description' => ts('the tables to be included in the count statement'),
367 'where' => 'civicrm_group.where_tables',
368 'table_name' => 'civicrm_group',
370 'bao' => 'CRM_Contact_BAO_Group',
372 'serialize' => self
::SERIALIZE_PHP
,
376 'name' => 'group_type',
377 'type' => CRM_Utils_Type
::T_STRING
,
378 'title' => ts('Group Type'),
379 'description' => ts('FK to group type'),
381 'size' => CRM_Utils_Type
::HUGE
,
382 'where' => 'civicrm_group.group_type',
383 'table_name' => 'civicrm_group',
385 'bao' => 'CRM_Contact_BAO_Group',
387 'serialize' => self
::SERIALIZE_SEPARATOR_BOOKEND
,
388 'pseudoconstant' => [
389 'optionGroupName' => 'group_type',
390 'optionEditPath' => 'civicrm/admin/options/group_type',
395 'name' => 'cache_date',
396 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
397 'title' => ts('Group Cache Date'),
398 'description' => ts('Date when we created the cache for a smart group'),
400 'where' => 'civicrm_group.cache_date',
401 'table_name' => 'civicrm_group',
403 'bao' => 'CRM_Contact_BAO_Group',
408 'name' => 'refresh_date',
409 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
410 'title' => ts('Next Group Refresh Time'),
411 'description' => ts('Date and time when we need to refresh the cache next.'),
413 'where' => 'civicrm_group.refresh_date',
414 'table_name' => 'civicrm_group',
416 'bao' => 'CRM_Contact_BAO_Group',
422 'type' => CRM_Utils_Type
::T_TEXT
,
423 'title' => ts('Group Parents'),
424 'description' => ts('IDs of the parent(s)'),
425 'where' => 'civicrm_group.parents',
426 'table_name' => 'civicrm_group',
428 'bao' => 'CRM_Contact_BAO_Group',
430 'serialize' => self
::SERIALIZE_COMMA
,
431 'pseudoconstant' => [
432 'callback' => 'CRM_Core_PseudoConstant::allGroup',
437 'name' => 'children',
438 'type' => CRM_Utils_Type
::T_TEXT
,
439 'title' => ts('Group Children'),
440 'description' => ts('IDs of the child(ren)'),
441 'where' => 'civicrm_group.children',
442 'table_name' => 'civicrm_group',
444 'bao' => 'CRM_Contact_BAO_Group',
449 'name' => 'is_hidden',
450 'type' => CRM_Utils_Type
::T_BOOLEAN
,
451 'title' => ts('Group is Hidden'),
452 'description' => ts('Is this group hidden?'),
453 'where' => 'civicrm_group.is_hidden',
455 'table_name' => 'civicrm_group',
457 'bao' => 'CRM_Contact_BAO_Group',
462 'name' => 'is_reserved',
463 'type' => CRM_Utils_Type
::T_BOOLEAN
,
464 'title' => ts('Group is Reserved'),
465 'where' => 'civicrm_group.is_reserved',
467 'table_name' => 'civicrm_group',
469 'bao' => 'CRM_Contact_BAO_Group',
474 'name' => 'created_id',
475 'type' => CRM_Utils_Type
::T_INT
,
476 'title' => ts('Group Created By'),
477 'description' => ts('FK to contact table.'),
478 'where' => 'civicrm_group.created_id',
479 'table_name' => 'civicrm_group',
481 'bao' => 'CRM_Contact_BAO_Group',
483 'FKClassName' => 'CRM_Contact_DAO_Contact',
487 'name' => 'modified_id',
488 'type' => CRM_Utils_Type
::T_INT
,
489 'title' => ts('Group Modified By'),
490 'description' => ts('FK to contact table.'),
491 'where' => 'civicrm_group.modified_id',
492 'table_name' => 'civicrm_group',
494 'bao' => 'CRM_Contact_BAO_Group',
496 'FKClassName' => 'CRM_Contact_DAO_Contact',
500 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
502 return Civi
::$statics[__CLASS__
]['fields'];
506 * Return a mapping from field-name to the corresponding key (as used in fields()).
509 * Array(string $name => string $uniqueName).
511 public static function &fieldKeys() {
512 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
513 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
515 return Civi
::$statics[__CLASS__
]['fieldKeys'];
519 * Returns the names of this table
523 public static function getTableName() {
524 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
528 * Returns if this table needs to be logged
532 public function getLog() {
537 * Returns the list of fields that can be imported
539 * @param bool $prefix
543 public static function &import($prefix = FALSE) {
544 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'group', $prefix, []);
549 * Returns the list of fields that can be exported
551 * @param bool $prefix
555 public static function &export($prefix = FALSE) {
556 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'group', $prefix, []);
561 * Returns the list of indices
563 * @param bool $localize
567 public static function indices($localize = TRUE) {
569 'index_group_type' => [
570 'name' => 'index_group_type',
574 'localizable' => FALSE,
575 'sig' => 'civicrm_group::0::group_type',
578 'name' => 'UI_title',
582 'localizable' => TRUE,
584 'sig' => 'civicrm_group::1::title',
591 'localizable' => FALSE,
593 'sig' => 'civicrm_group::1::name',
596 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;